June 05, 2024 |740 Views

    PROBLEM OF THE DAY : 04/06/2024 | Binary representation of next number

    Description
    Discussion

    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