REPLACE THE BITS
CodeChefOpen on judge ↗
You are given two integers, N and M, and two bit positions, i and j. Write a method to replace all bits between i and j in the binary value of N with binary of M (e.g., M becomes a substring of N located at i and starting at j). Input Input consists of two lines - The first line consists of two integers N and M - The second line consists of Bit positions(integers) i and j Output For each in
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