Find the Sequence of Strings Appeared on the Screen - Practice Coding | SlaveCode
0
0123456789
0
0123456789
:
0
0123456789
0
0123456789
3324. Find the Sequence of Strings Appeared on the Screen
Medium
30 Points
String
Simulation
You are given a string target.
Alice is going to type target on her computer using a special keyboard that has only two keys:
Note that initially there is an empty string "" on the screen, so she can only press key 1.
Return a list of all strings that appear on the screen as Alice types target, in the order they appear, using the minimum key presses.
Examples
Example 1
Input: target = "abc"
Output: ["a","aa","ab","aba","abb","abc"]
Explanation:
The sequence of key presses done by Alice are:
target consists only of lowercase English letters.
3324. Find the Sequence of Strings Appeared on the Screen
Medium
30 Points
String
Simulation
You are given a string target.
Alice is going to type target on her computer using a special keyboard that has only two keys:
Note that initially there is an empty string "" on the screen, so she can only press key 1.
Return a list of all strings that appear on the screen as Alice types target, in the order they appear, using the minimum key presses.
Examples
Example 1
Input: target = "abc"
Output: ["a","aa","ab","aba","abb","abc"]
Explanation:
The sequence of key presses done by Alice are: