Skip to content

Practice Number of Strings Which Can Be Rearranged to Contain Substring

Read the task, work through the examples, and check your approach against the constraints. Use the original LeetCode task for coding and submissions.

Medium#2930
LeetCode Problem

Number of Strings Which Can Be Rearranged to Contain Substring

Problem Statement

You are given an integer n. A string s is called good if it contains only lowercase English characters and it is possible to rearrange the characters of s such that the new string contains "leet" as a substring. For example: Return the total number of good strings of length n. Since the answer may be large, return it modulo 10^9 + 7. A substring is a contiguous sequence of characters within a string.

Source: Number of Strings Which Can Be Rearranged to Contain Substring on LeetCode. Use the original task for its coding environment and submissions.

Examples

# Example 1

Input
n = 4
Output
12

# Example 2

Input
n = 10
Output
83943898

Constraints

1 <= n <= 10^5

Related LeetCode Problems

Practice more problems similar to Number of Strings Which Can Be Rearranged to Contain Substring.

Review your practice with PhantomCodeAI

After trying the problem yourself, use the app to discuss your approach, complexity, and edge cases.