FastPrepToken Validation
Problems/Token Validation

Token Validation

Rippling logoRippling● EasyFULLTIMEOA
QuestionFunctionExamplesConstraints

Problem statement

Source note: The source omits numeric bounds and repeated-space behavior. The judged core task matches the visible source at about 98%.

You are given a string tokenString containing tokens separated by one or more spaces.

A token is valid only when all of the following conditions hold:

  • It contains at least 3 characters.
  • Every character is an ASCII letter or decimal digit.
  • It contains at least one vowel: a, e, i, o, or u, ignoring letter case.
  • It contains at least one consonant, meaning an ASCII letter that is not a vowel.

Digits are allowed, but they are neither vowels nor consonants. Return the number of valid tokens in tokenString. Empty segments created by repeated spaces are ignored.

Function

countValidTokens(tokenString: String) → int

Examples

Example 1

tokenString = "This is an example string 234."return = 3

The valid tokens are This, example, and string. The tokens is and an are too short, while 234. contains a non-alphanumeric character.

Example 2

tokenString = "a1b 123  bcE9"return = 2

a1b and bcE9 each contain a vowel and a consonant. 123 has no letters, so the result is 2.

Example 3

tokenString = "AEI bcd xy!"return = 0

AEI has no consonant, bcd has no vowel, and xy! contains a non-alphanumeric character.

Constraints

  • For this exercise, assume 1 <= tokenString.length <= 100000.
  • For this exercise, assume tokens are separated by one or more ASCII space characters.

More Rippling problems

  • Stateful Log Transform and SearchPHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
  • Dependency-Aware Task SchedulerPHONE SCREEN · Seen Nov 2026
  • Filter, Sort, and Deduplicate Scheduled TasksPHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
All Rippling interview questionsSee Rippling hiring insights
Saved
class Solution {
    public int countValidTokens(String tokenString) {
        // Write your code here.
    }

}
Checking account…