Skip to content

Commit b3ada51

Browse files
add 3136
1 parent 0190cf4 commit b3ada51

File tree

2 files changed

+29
-0
lines changed
  • paginated_contents/algorithms/4th_thousand
  • src/main/java/com/fishercoder/solutions/fourththousand

2 files changed

+29
-0
lines changed

Diff for: paginated_contents/algorithms/4th_thousand/README.md

+1
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@
4141
| 3151 | [Special Array I](https://leetcode.com/problems/special-array-i/) | [Java](https://github.com/fishercoder1534/Leetcode/blob/master/src/main/java/com/fishercoder/solutions/fourththousand/_3151.java) | | Easy |
4242
| 3146 | [Permutation Difference between Two Strings](https://leetcode.com/problems/permutation-difference-between-two-strings/) | [Java](https://github.com/fishercoder1534/Leetcode/blob/master/src/main/java/com/fishercoder/solutions/fourththousand/_3146.java) | | Easy |
4343
| 3142 | [Check if Grid Satisfies Conditions](https://leetcode.com/problems/check-if-grid-satisfies-conditions/) | [Java](https://github.com/fishercoder1534/Leetcode/blob/master/src/main/java/com/fishercoder/solutions/fourththousand/_3142.java) | | Easy |
44+
| 3136 | [Valid Word](https://leetcode.com/problems/valid-word/) | [Java](https://github.com/fishercoder1534/Leetcode/blob/master/src/main/java/com/fishercoder/solutions/fourththousand/_3136.java) | | Easy |
4445
| 3131 | [Find the Integer Added to Array I](https://leetcode.com/problems/find-the-integer-added-to-array-i/) | [Java](https://github.com/fishercoder1534/Leetcode/blob/master/src/main/java/com/fishercoder/solutions/fourththousand/_3131.java) | | Easy |
4546
| 3127 | [Make a Square with the Same Color](https://leetcode.com/problems/make-a-square-with-the-same-color/) | [Java](https://github.com/fishercoder1534/Leetcode/blob/master/src/main/java/com/fishercoder/solutions/fourththousand/_3127.java) | | Easy |
4647
| 3120 | [Count the Number of Special Characters I](https://leetcode.com/problems/count-the-number-of-special-characters-i/) | [Java](https://github.com/fishercoder1534/Leetcode/blob/master/src/main/java/com/fishercoder/solutions/fourththousand/_3120.java) | | Easy |
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
package com.fishercoder.solutions.fourththousand;
2+
3+
import java.util.Arrays;
4+
import java.util.HashSet;
5+
import java.util.Set;
6+
7+
public class _3136 {
8+
public static class Solution1 {
9+
public boolean isValid(String word) {
10+
if (word.length() < 3) {
11+
return false;
12+
}
13+
Set<Character> vowels = new HashSet<>(Arrays.asList('a', 'e', 'i', 'o', 'u', 'A', 'E', 'I', 'O', 'U'));
14+
boolean containsVowel = false;
15+
boolean containsConsonant = false;
16+
for (char c : word.toCharArray()) {
17+
if (vowels.contains(c)) {
18+
containsVowel = true;
19+
} else if (Character.isAlphabetic(c)) {
20+
containsConsonant = true;
21+
} else if (!Character.isDigit(c)) {
22+
return false;
23+
}
24+
}
25+
return containsVowel && containsConsonant;
26+
}
27+
}
28+
}

0 commit comments

Comments
 (0)