Cutting Recipes

Why I am getting a wrong answer on my code! It works fine for most of the values. What is the possible testcase that can go wrong? I’m new here, it’ll be very helpful if someone replies. Thank you in advance!

Problem link- question

link to my code- solution

that ‘min’ was for another approach! // please ignore

Consider the test input:

1
2 192 164
2 Likes

:hushed: Thank you so much for replying. And the reply was an eye opener! The code doesn’t work for any of the values if the 1st digit is greater than the 2nd one!
Ex- 3
4
14 8 16 4
3
16 9 4
2
9 4
I really have to thank you on this! This was my very 1st post, and I was getting shy to ask the question. But when I did, you replied within an hour! :smile:

1 Like