3324. Find the Sequence of Strings Appeared on the Screen Medium

@problem@discussion
#String#Simulation



1/**
2 * [3324] Find the Sequence of Strings Appeared on the Screen
3 *
4 * You are given a string target.
5 * Alice is going to type target on her computer using a special keyboard that has only two keys:
6 * 
7 * 	Key 1 appends the character "a" to the string on the screen.
8 * 	Key 2 changes the last character of the string on the screen to its next character in the English alphabet. For example, "c" changes to "d" and "z" changes to "a".
9 * 
10 * Note that initially there is an empty string "" on the screen, so she can only press key 1.
11 * 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.
12 *  
13 * <strong class="example">Example 1:
14 * <div class="example-block">
15 * Input: <span class="example-io">target = "abc"</span>
16 * Output: <span class="example-io">["a","aa","ab","aba","abb","abc"]</span>
17 * Explanation:
18 * The sequence of key presses done by Alice are:
19 * 
20 * 	Press key 1, and the string on the screen becomes "a".
21 * 	Press key 1, and the string on the screen becomes "aa".
22 * 	Press key 2, and the string on the screen becomes "ab".
23 * 	Press key 1, and the string on the screen becomes "aba".
24 * 	Press key 2, and the string on the screen becomes "abb".
25 * 	Press key 2, and the string on the screen becomes "abc".
26 * </div>
27 * <strong class="example">Example 2:
28 * <div class="example-block">
29 * Input: <span class="example-io">target = "he"</span>
30 * Output: <span class="example-io">["a","b","c","d","e","f","g","h","ha","hb","hc","hd","he"]</span>
31 * </div>
32 *  
33 * Constraints:
34 * 
35 * 	1 <= target.length <= 400
36 * 	target consists only of lowercase English letters.
37 * 
38 */
39pub struct Solution {}
40
41// problem: https://leetcode.com/problems/find-the-sequence-of-strings-appeared-on-the-screen/
42// discuss: https://leetcode.com/problems/find-the-sequence-of-strings-appeared-on-the-screen/discuss/?currentPage=1&orderBy=most_votes&query=
43
44// submission codes start here
45
46impl Solution {
47    pub fn string_sequence(target: String) -> Vec<String> {
48        vec![]
49    }
50}
51
52// submission codes end
53
54#[cfg(test)]
55mod tests {
56    use super::*;
57
58    #[test]
59    fn test_3324() {
60    }
61}
62


Back
© 2025 bowen.ge All Rights Reserved.