Sponsored
Sponsored
Use these hints if you're stuck. Try solving on your own first.
Try using a greedy approach where you take as many digits as possible from the left of the string for each partition.
You can also use a dynamic programming approach, let an array dp where dp[i] is the solution of the problem for the prefix of the string ending at index i, the answer of the problem will be dp[n-1]. What are the transitions of this dp?