First of all, horrible website. The complier is giving error with no clue as to why the error is happening.
Second, shitty UI, but okay compared to others. I really went squint to read the question properly.
2 Questions, no breaks in between:
n = 7
sum = 1 + 2 + 3 + 4 + 5 + 6 + 7 = 28
digits = 2 as 28 has to digitsn = 13
n = 5 + 5 + 3
steps = 3
dp = min({pick(n - 1), pick(n-2), pick(n-3), pick(n-4), pick(n-5)});
Variation of coin change but with the cost of picking each step same.
Greedy also works. Any number can be reduced by this denominations. But wouldn't generate the minimum number of denominations. Just one/more denominations that work!