Make Sum OR
CodeChefOpen on judge ↗
Sarthak is very curious about Logical Gates. He learned about XOR, OR and AND operation. ay2306 gave him an array, $A$, of size $N$. Sarthak finds a positive integer $K$ adorable and wants to buy another array $B$ of same size such that $$\sum_{i=1}^{N} A[i] | B[i] = K$$. Help shopkeeper to find such an array $B$, or tell if it does not exist. ###Input: - First line will contain $N$ and $
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