Binary Alternating Bits Solution with XOR and Bit Tricks

#day314 of #1001daysofcode problem statement (0693): Binary Number with Alternating Bits Used XOR with right shift to transform alternating bits into a sequence of 1s, then applied the (x & (x + 1)) == 0 pattern(tocheck all bits are set bits or not). Sometimes bit tricks make problems beautifully simple. #1001DaysOfCode #DSA #Java #LeetCode #ProblemSolving Shivam Mahajan #leetcode

  • graphical user interface, text

To view or add a comment, sign in

Explore content categories