October 21, 2024 |70 Views

    PROBLEM OF THE DAY : 19/10/2024 | Nearest multiple of 10

    Description
    Discussion

    Welcome to the daily solving of our PROBLEM OF THE DAY with Ayush Tripathi 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 String but also build up problem-solving skills.

    A string str is given to represent a positive number. The task is to round str to the nearest multiple of 10.  If you have two multiples equally apart from str, choose the smallest element among them.

    Examples:
     

    Input: str = 29 
    Output: 30
    Explanation: Close multiples are 20 and 30, and 30 is the nearest to 29. 
     

    Give the problem a try before going through the video. All the best!!!
    Problem Link: https://practice.geeksforgeeks.org/problems/nearest-multiple-of-102437/1