Search
⌘K

Leetcode 2466. Count Ways To Build Good Strings

You can repeatedly append either a block of '0' characters of length zero or a block of '1' characters of length one; count how many distinct binary strings have total length in [low, high]. This is a counting/Dynamic Programming problem (like coin-change/compositions) where dp[len] = dp[len-zero] + dp[len-one], and you sum dp[low..high] modulo 1e9+7.


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.