1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
| class Solution {
private static final Set<Character> set = new HashSet<>(Set.of('a', 'e', 'i', 'o', 'u'));
public int vowelStrings(String[] words, int left, int right) { int ans = 0; for (int i = left; i <= right; ++i) { String s = words[i]; if (set.contains(s.charAt(0)) && set.contains(s.charAt(s.length() - 1))) { ++ans; } } return ans; } }
|