https://practice.geeksforgeeks.org/problems/ncr1019/1