FastPrepFastPrep
Problem Brief

Number of Substrings Without Vowels

OA
See Tiktok online assessment and hiring insights

Given a string (length 1 to 1000), return the number of substrings which don't have any vowels. Circular substrings are valid.

1Example 1

Input
s = "abc"
Output
3
Explanation
All possible substrings are: a, b, c, ab, bc, ca, abc, bca, cab substrings that do not have vowels are: b, c, bc so we return 3

Constraints

Limits and guarantees your solution can rely on.

🙋‍♀️
public int numberOfSubstringsWithoutVowels(String s) {
  // write your code here
}
Input

s

"abc"

Output

3

Sign in to submit your solution.