Split Array
CodeChefOpen on judge ↗
Chef has a sequence of $N$ positive integers. He also has two boxes A and B. He wants to put each number in the array into either box A or B. He also wants to make sure that there is at least 1 number in each of the boxes. The boxes have a magical display on them which displays a value depending on the elements inside it. The value of Box A is the BITWISE AND of all the numbers inside it. If
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