Ad
  • Default User Avatar

    I had a solution where I used a for loop in a while loop, tried some test cases myself and it works, the only issue with this is that since the numbers can become very big in the end, the program ended up taking way too long to process since it has to generate a lot of numbers, so in the end, I cannot attempt it and submit the solution even though this code can work.