Paytm Labs interview question

LeetCode # 49 answer on leetcode for free