![]() |
VOOZH | about |
Given a non-negative integer n. The problem is to increment n by 1 by manipulating the bits of n.
Examples :
Input : 6 Output : 7 Input : 15 Output : 16
Approach: Following are the steps:
Output :
16
Time Complexity: O(1)
Space Complexity: O(1)