Search
⌘K

Leetcode 2522. Partition String Into Substrings With Values at Most K

Partition the digit string s into the fewest contiguous substrings such that the integer value of each substring is <= k (return -1 if impossible). This requires a linear scan/greedy (or DP) approach to build the longest valid number segments under constraints s.length ≤ 1e5 and k ≤ 1e9.


Question Timeline

See when this question was last asked and where, including any notes left by other candidates.

Your account is free and you can post anonymously if you choose.