N = (N | ((1(j-i+1)-1)i) (Mi);
On 12 October 2011 01:22, prasad jondhale jondhale.pra...@gmail.com wrote:
grt
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks group.
To post to this group, send email to algogeeks@googlegroups.com.
To
N=(N( (~0j) | (~(1i))) | (Mi)
With regards,
Praveen Raj
DCE-IT
735993
praveen0...@gmail.com
On Tue, Oct 25, 2011 at 11:46 AM, Bittu Sarkar bittu...@gmail.com wrote:
N = (N | ((1(j-i+1)-1)i) (Mi);
On 12 October 2011 01:22, prasad jondhale jondhale.pra...@gmail.comwrote:
grt
This is a question from Laakman.
This code operates by clearing all bits in N between position i and j, and then
ORing to put M in there
1 public static int updateBits(int n, int m, int i, int j) {
2 int max = ~0; /* All 1's */
3
4 // 1's through position j, then 0's
5 int left = max
grt
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group
You are given two 32-bit numbers, N and M, and two bit positions, i and j.
Write a method to set all bits between i and j in N equal to M (e.g., M
becomes a substring of N located at i and starting at j).
EXAMPLE:
Input: N = 100, M = 10101, i = 2, j = 6
Output: N = 10001010100
_