Welcome to the daily solving of our PROBLEM OF THE DAY with Nitin Kaplas 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 Linked List but also build up problem-solving skills.
You are given a linked list where each element in the list is a node and have an integer data. You need to add 1 to the number formed by concatinating all the list node numbers together and return the head of the modified linked list.
Note: The head represents the first element of the given array.
Examples :
Input: LinkedList: 4->5->6
Output: 457
Explanation: 4->5->6 represents 456 and when 1 is added it becomes 457.
Give the problem a try before going through the video. All the best!!!
Problem Link: https://practice.geeksforgeeks.org/problems/add-1-to-a-number-represented-as-linked-list/1