Skip to content

Practice Find the Sequence of Strings Appeared on the Screen

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

Medium#3324
LeetCode Problem

Find the Sequence of Strings Appeared on the Screen

Problem Statement

Start with an empty screen. Key 1 appends a; key 2 advances the last character by one letter, wrapping z to a, and requires a nonempty screen. Type target using the fewest key presses. Return the string visible after every key press, in order, including the final target.

Source: Find the Sequence of Strings Appeared on the Screen on LeetCode. Use the original task for its coding environment and submissions.

Examples

# Example 1

Input
target = "abc"
Output
["a","aa","ab","aba","abb","abc"]

# Example 2

Input
target = "he"
Output
["a","b","c","d","e","f","g","h","ha","hb","hc","hd","he"]

Constraints

1 <= target.length <= 400
target consists only of lowercase English letters.

Related LeetCode Problems

Practice more problems similar to Find the Sequence of Strings Appeared on the Screen.

Review your practice with PhantomCodeAI

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