Mockbit/#1
DSAeasyStrings~10m

Test Question

Problem

You are developing a low-level communication protocol for a satellite array. To prevent signal interference, every data packet—represented as a string of lowercase English letters—must be Stable.

A packet is considered Stable if every vowel in the string is immediately followed by a consonant.

Grounding Rule: If a vowel is the last character in the string, the packet is automatically considered Unstable because it lacks a trailing consonant to "ground" the signal.

Vowels are defined as: {'a', 'e', 'i', 'o', 'u'}. All other lowercase English letters are considered consonants.

Examples

Example 1

Input: "orbit"
Output: True

'o' is followed by 'r', and 'i' is followed by 't'. Both vowels are grounded.

Example 2

Input: "data"
Output: False

The last character 'a' is a vowel and has no following consonant to ground it.

Constraints
  • 1 <= packet.length <= 10^5
  • packet consists of lowercase English letters.
  • Time Complexity: O(N)
  • Space Complexity: O(1)
Reference solution

Reference solution available after you attempt the question.

Ready to solve it?

Start a session on Mockbit #1. You'll get graded with specific critique when you submit.

← Back homemockbit.io/q/1
PrivacyTerms© 2026 Mockbit