Practice Find All Good Strings
Read the task, work through the examples, and check your approach against the constraints. Use the original LeetCode task for coding and submissions.
Problem Statement
Given the strings s1 and s2 of size n and the string evil, return the number of good strings. A good string has size n, it is alphabetically greater than or equal to s1, it is alphabetically smaller than or equal to s2, and it does not contain the string evil as a substring. Since the answer can be a huge number, return this modulo 10^9 + 7.
Source: Find All Good Strings on LeetCode. Use the original task for its coding environment and submissions.
Examples
# Example 1
n = 2, s1 = "aa", s2 = "da", evil = "b"
51
# Example 2
n = 8, s1 = "leetcode", s2 = "leetgoes", evil = "leet"
0
# Example 3
n = 2, s1 = "gx", s2 = "gz", evil = "x"
2
Constraints
Related LeetCode Problems
Practice more problems similar to Find All Good Strings.
Review your practice with PhantomCodeAI
After trying the problem yourself, use the app to discuss your approach, complexity, and edge cases.