CodeMentor
.
Ask AI
Problems
Learn
C++
TCS
Core CS
HR
Progress
Search
Ctrl
K
0
Lv 1
Problems
Intro Dynamic Programming
Coin Change
Medium
LeetCode
3/3
00:00
Hint
Run
Ctrl
↵
Submit
Description
Lesson
Code walk
Solution
Medium
Intro Dynamic Programming
LeetCode #322
Coin Change
Fewest coins for amount. dp[x] = min over coin of dp[x-coin]+1.
Examples
Example 1
Input
3 11 1 2 5
Output
3
Example 2
Input
1 3 2
Output
-1
Stuck? Take a nudge
Reveal hint 1 of 3
C++17
Autosaves
Reset
Console
Run your code to see results