Skip to content

Commit cec7bab

Browse files
committed
Jul 15
1 parent eed9691 commit cec7bab

File tree

2 files changed

+34
-2
lines changed

2 files changed

+34
-2
lines changed

2025-07-July-LeetCoding-Challenge/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
| July 12 | [1900. The Earliest and Latest Rounds Where Players Compete](https://leetcode.com/problems/the-earliest-and-latest-rounds-where-players-compete/) | Hard | Unsolved |
1919
| July 13 | [2410. Maximum Matching of Players With Trainers](https://leetcode.com/problems/maximum-matching-of-players-with-trainers/) | Medium | Solved |
2020
| July 14 | [1290. Convert Binary Number in a Linked List to Integer](https://leetcode.com/problems/convert-binary-number-in-a-linked-list-to-integer/) | Easy | Solved |
21-
| July 15 | []() | | |
21+
| July 15 | [3136. Valid Word](https://leetcode.com/problems/valid-word/) | Easy | Solved |
2222
| July 16 | []() | | |
2323
| July 17 | []() | | |
2424
| July 18 | []() | | |
@@ -40,6 +40,6 @@
4040
## Summary
4141
| Level | Problems | Solved | Unsolved |
4242
| --- | --- | --- | --- |
43-
| Easy | 4 | 4 | 0 |
43+
| Easy | 5 | 5 | 0 |
4444
| Medium | 5 | 5 | 0 |
4545
| Hard | 5 | 1 | 4 |
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
class Solution:
2+
VOWELS = {'a', 'e', 'i', 'o', 'u'}
3+
4+
def isValid(self, word: str) -> bool:
5+
if len(word) < 3:
6+
return False
7+
has_vowel, has_consonant = False, False
8+
for ch in word.lower():
9+
if not ch.isalpha():
10+
if not ch.isdigit():
11+
return False
12+
else:
13+
if ch in self.VOWELS:
14+
has_vowel = True
15+
else:
16+
has_consonant = True
17+
return has_vowel and has_consonant
18+
19+
20+
def main():
21+
word = '234Adas'
22+
assert Solution().isValid(word) is True
23+
24+
word = 'b3'
25+
assert Solution().isValid(word) is False
26+
27+
word = 'a3$e'
28+
assert Solution().isValid(word) is False
29+
30+
31+
if __name__ == '__main__':
32+
main()

0 commit comments

Comments
 (0)