Given an integer N represented in the form of a string, remove consecutive repeated digits from it.
Input: N = 1224 Output: 124 Explanation: Two consecutive occurrences of 2 have been reduced to one.
Input: N = 1242 Output: 1242 Explanation: No digit is repeating consecutively in N.
You don't need to read input or print anything. Your task is to complete the function modify() which takes the integer N as input and returns the modified integer by removing all the consecutive duplicate occurrences in N.
Expected Time Complexity: O(LogN).
Expected Auxiliary Space: O(1).
We strongly recommend solving this problem on your own before viewing its editorial. Do you still want to view the editorial?Yes