forked from fishercoder1534/Leetcode
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path_2586.java
27 lines (24 loc) · 784 Bytes
/
_2586.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
package com.fishercoder.solutions;
import java.util.Arrays;
import java.util.HashSet;
import java.util.Set;
public class _2586 {
public static class Solution1 {
public int vowelStrings(String[] words, int left, int right) {
int count = 0;
for (int i = left; i <= right; i++) {
if (isVowelString(words[i])) {
count++;
}
}
return count;
}
private boolean isVowelString(String word) {
Set<Character> set = new HashSet<>(Arrays.asList('a', 'e', 'i', 'o', 'u'));
if (set.contains(word.charAt(0)) && set.contains(word.charAt(word.length() - 1))) {
return true;
}
return false;
}
}
}