Insertion
problem
You are given two 32bit numbers n and m and two bit positions, i and j. Write a method to insert M into N such that M starts at bit j and ends at bit i.
how to solve
- Clear the bits j through i in N
- Shift M so that it lines up with bits j through i
- Merge M and N