Interview Question

Revision en2, by gXa, 2018-12-03 20:15:08

There are 3 integers a, b, w.

There are 2 equations –

w+a=b

a (bitwise AND) b = 0;

I was given the value of w and he asked me to calculate the number of pairs (a, b) satisfying the two equations.

Tags bitmasking

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en2 English gXa 2018-12-03 20:15:08 1 Tiny change: 'e AND) b =0;\n\nI wa' -> 'e AND) b = 0;\n\nI wa'
en1 English gXa 2018-12-03 20:14:50 227 Initial revision (published)