925. Long Pressed Name Easy

@problem@discussion
#Two Pointers#String



1/**
2 * [925] Long Pressed Name
3 *
4 * Your friend is typing his name into a keyboard. Sometimes, when typing a character c, the key might get long pressed, and the character will be typed 1 or more times.
5 * You examine the typed characters of the keyboard. Return True if it is possible that it was your friends name, with some characters (possibly none) being long pressed.
6 *  
7 * Example 1:
8 * 
9 * Input: name = "alex", typed = "aaleex"
10 * Output: true
11 * Explanation: 'a' and 'e' in 'alex' were long pressed.
12 * 
13 * Example 2:
14 * 
15 * Input: name = "saeed", typed = "ssaaedd"
16 * Output: false
17 * Explanation: 'e' must have been pressed twice, but it was not in the typed output.
18 * 
19 *  
20 * Constraints:
21 * 
22 * 	1 <= name.length, typed.length <= 1000
23 * 	name and typed consist of only lowercase English letters.
24 * 
25 */
26pub struct Solution {}
27
28// problem: https://leetcode.com/problems/long-pressed-name/
29// discuss: https://leetcode.com/problems/long-pressed-name/discuss/?currentPage=1&orderBy=most_votes&query=
30
31// submission codes start here
32
33impl Solution {
34    pub fn is_long_pressed_name(name: String, typed: String) -> bool {
35        false
36    }
37}
38
39// submission codes end
40
41#[cfg(test)]
42mod tests {
43    use super::*;
44
45    #[test]
46    fn test_925() {
47    }
48}
49


Back
© 2025 bowen.ge All Rights Reserved.