Proper Masked XOR
CodeChefOpen on judge ↗
A list of numbers a1,a2,…,an is called proper-masked if for all i from 1 to n−1 all ones (of binary representation) in a[i] are in the places of ones (of binary representation) in a[i+1] (in other words, a[i]&[ai+1]=a[i], where & denotes bitwise AND). If n=1 then the sequence is considered proper-masked as well. For example, the following four sequences are proper-masked: [2,3,15,175] — in bin
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