Two friends, Frodo and Sam, are playing a game, "Coins Stacking" where they have a total of N-1 number of coins and a desired amount K. The coins have values ranging from 2,3, 4, ... up to N. The objective of the game is to stack these coins to get the sum greater than or equal to the desired amount K. But there is a condition that whenever they keep a coin on top of the other, its value is decremented by 1. Your task is to help Frodo and Sam achieve the objective of the game. Note: If the desired amount cannot be achieved, return -1. Input Specification: programming
Answers
Answered by
0
Answer:
The idea is to create a table of size n+1 to store counts of all scores from 0 to n. For every possible move (3, 5 and 10), increment values in ...
Similar questions