Welcome to the daily solving of our PROBLEM OF THE DAY with Yash Dwivedi. We will discuss the entire problem step-by-step and work towards developing an optimized solution. This will not only help you brush up on your concepts of Bit Manipulation but also build up problem-solving skills.
Given a binary representation in the form of a string(s) of a number n, the task is to find a binary representation of n+1.
Note: Output binary string should not contain leading zeros.
Example 1:
Input: s = "10"
Output: 11
Explanation: "10" is the binary representation of 2 and binary representation of 3 is "11"
Give the problem a try before going through the video. All the best!!!
Problem Link: https://practice.geeksforgeeks.org/problems/binary-representation-of-next-number3648/1