Search
⌘K

Leetcode 3333. Find the Original Typed String II

Count how many original strings (of length at least k) could have produced the given final word if each intended character may have been long-pressed into one or more copies — equivalently, for each run of identical letters of length L choose how many original occurrences (1..L) it came from, with weight C(L-1, m-1). The core challenge is combinatorics + knapsack-style DP (k ≤ 2000, word length up to 5e5) to aggregate these per-run choices modulo 1e9+7.


Question Timeline

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

Comments

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