brewersfan1976

second_right_most_zero_bit.rb

Sep 25th, 2016
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 0.09 KB | None | 0 0
  1. def secondRightmostZeroBit(n)
  2.     return -~((n-~(n^(n+1))/2)^(n-~(n^(n+1))/2+1))/2
  3. end
Advertisement
Add Comment
Please, Sign In to add comment