AlgoMaster Logo

Bitwise AND of Numbers Range

left=5,right=7
0 / 8
76543210left= 5& right= 7result0000010100000111
algomaster.io
Step:AND every number from 5 to 7: the differing low bits get wiped out, only the shared prefix survives