1935. Maximum Number of Words You Can Type Easy
1/**
2 * [1935] Maximum Number of Words You Can Type
3 *
4 * There is a malfunctioning keyboard where some letter keys do not work. All other keys on the keyboard work properly.
5 * Given a string text of words separated by a single space (no leading or trailing spaces) and a string brokenLetters of all distinct letter keys that are broken, return the number of words in text you can fully type using this keyboard.
6 *
7 * Example 1:
8 *
9 * Input: text = "hello world", brokenLetters = "ad"
10 * Output: 1
11 * Explanation: We cannot type "world" because the 'd' key is broken.
12 *
13 * Example 2:
14 *
15 * Input: text = "leet code", brokenLetters = "lt"
16 * Output: 1
17 * Explanation: We cannot type "leet" because the 'l' and 't' keys are broken.
18 *
19 * Example 3:
20 *
21 * Input: text = "leet code", brokenLetters = "e"
22 * Output: 0
23 * Explanation: We cannot type either word because the 'e' key is broken.
24 *
25 *
26 * Constraints:
27 *
28 * 1 <= text.length <= 10^4
29 * 0 <= brokenLetters.length <= 26
30 * text consists of words separated by a single space without any leading or trailing spaces.
31 * Each word only consists of lowercase English letters.
32 * brokenLetters consists of distinct lowercase English letters.
33 *
34 */
35pub struct Solution {}
36
37// problem: https://leetcode.com/problems/maximum-number-of-words-you-can-type/
38// discuss: https://leetcode.com/problems/maximum-number-of-words-you-can-type/discuss/?currentPage=1&orderBy=most_votes&query=
39
40// submission codes start here
41
42impl Solution {
43 pub fn can_be_typed_words(text: String, broken_letters: String) -> i32 {
44 0
45 }
46}
47
48// submission codes end
49
50#[cfg(test)]
51mod tests {
52 use super::*;
53
54 #[test]
55 fn test_1935() {
56 }
57}
58
Back
© 2025 bowen.ge All Rights Reserved.