Exchanging Coins


Getting Run error.
Please modify my code

@dsingh200021 See the constraints
Constraints:
0 <= n <= 1 000 000 000
Run error may be due to array indexes out of bounds as your code is running for smaller test cases.