← Oracle Interview Insights

Oracle·Software Engineer·Technical Phone Screen·Intermediate

Intermediate
May 2026

Summary

Oracle SWE interview with a string manipulation problem that sounds straightforward until you actually sit with it for a minute.

Questions Asked (1)

Q1

Given a string, count the number of substrings that contain all five vowels (a, e, i, o, u) and consist only of vowels.

Algorithms & Data Structures
Author's notes

My first instinct was a brute force with nested loops and I just went with it.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Clarify the problem first: substrings must consist entirely of vowels and contain all five vowels. Then propose an efficient sliding window approach that expands and contracts to count valid substrings in O(n) time, explaining how to handle the 'all five vowels' condition with a frequency map.

Pro tip: Mention edge cases like strings with no vowels or fewer than five vowels, and discuss how the sliding window avoids redundant checks by leveraging the fact that once a window is valid, all larger windows ending at the same right pointer are also valid.

1. Clarify requirements and constraints

Confirm that substrings must consist only of vowels and contain all five vowels. Ask about input size, character set, and whether case matters.

2. Outline brute-force and its complexity

Briefly describe the naive O(n^2) approach of checking every substring, noting it's inefficient for large inputs.

3. Propose sliding window solution

Explain using two pointers (left and right) to maintain a window of vowels, and a frequency map to track vowel counts. Expand right, and when all five vowels are present, count valid substrings ending at right and move left to find more.

4. Detail counting logic

When the window contains all five vowels, the number of valid substrings ending at right is (left - start + 1), where start is the first index after the last non-vowel. Increment count accordingly.

5. Analyze complexity and edge cases

State O(n) time and O(1) space (since only 5 vowels). Discuss edge cases: empty string, no vowels, fewer than five distinct vowels, and uppercase letters.

Key Points to Mention

  • Sliding window technique for O(n) time complexity
  • Frequency map (or array) to track counts of each vowel
  • Handling non-vowel characters by resetting the window
  • Counting all valid substrings efficiently without enumerating them
  • Edge cases: strings with no vowels, fewer than five vowels, and case sensitivity
  • Space complexity O(1) due to fixed vowel set

AI-generated suggestions, not part of the candidate's original notes. May be inaccurate — verify before relying on them.