What is wrong in this code?

Question link:Buying Sweets

My code link:Answer

When i write the same logic with different implementation i get a AC. Can someone please help me out?

Accepted solution link:AC answer link

Oh man, Your whole code was right. You just forgot to add ‘=’ in the condition in “any_of” statement, as the program should give -1 even when we have a note with value sum % x.

Here is the solution. I just have added the ‘=’ sign in it.

Oh!!..thank you for the help…:slight_smile: