Skip to content

Latest commit

 

History

History

Count Number of Ways to Reach A Given Score in A Game

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 

Consider a game where a player can score 3 or 5 or 10 points in a move. Given a total score n, find number of ways to reach the given score.

Input: n = 20
Output: 4
There are following 4 ways to reach 20
(10, 10)
(5, 5, 10)
(5, 5, 5, 5)
(3, 3, 3, 3, 3, 5)

Input: n = 13
Output: 2
There are following 2 ways to reach 13
(3, 5, 5)
(3, 10)