Parity Fun
Chef has $N$ numbers written on his board. He wants only one number to remain on the board and so he devises a special tactic to do so. He randomly picks up $2$ numbers written on the board say $A$ and $B$ respectively. He erases both of them from the board and writes a new number on the board which equals - - $A - B$ if parity of $A$ $=$ parity of $B$ - $A + B$ if parity of $A$ $\neq$ parity
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