← Questions
Count non-decreasing arrays with given digit sums
0
I was asked this
No reports yet. Sign in to say where you were asked it.
You get an array requiredSum of length n. Count arrays result of length n that are non-decreasing and where the digit sum of result[i] equals requiredSum[i] for every i, within the value bound the problem gives; return the count modulo a large prime. Explain the dynamic programming over positions and values and how prefix sums keep it fast.
No official answer yet. Write yours on the right and run it.
Nothing published yet.
Sign in to submit your code; every attempt is kept here.
Write and test your solution herePython in your browser, the question's tests level by level, every submission kept for you.Sign in to start coding
