Winning Strategy
CodeChefOpen on judge ↗
Problem Statement You are given an array of $n$ integers and there are $2$ people: $P1$ and $P2$. Each person picks up any one element and adds its value to their score. Initially the score of both $P1$ and $P2$ is $0$ . However the person who plays second can take two elements in his/her first try and then both will take one element in alternate turns. Example: if $P1$ goes first, then the
HINT LADDERno hints yet
L1 Observation
L2 Technique
L3 Approach
L4 Pseudo-code
🔒
L5 Full solution
L5 unlocks only if you insist twice
solution.cppC++17
CodeSearch Tutor
Hints, not spoilers — it won’t hand over the full solution unless you insist.
Sign in to chat with the tutor and save your progress.
Sign in to start