← Hudson River Trading Interview Insights

Hudson River Trading·Software Engineer·Online Assessment (OA)·Intermediate

Intermediate
May 2026

Summary

Got an OA from Hudson River Trading for a software engineer role. Pretty straightforward string manipulation problem, nothing that'll keep you up at night, but the linear-time hint in the constraints was a nice nudge toward thinking about efficiency.

Questions Asked (1)

Q1

Given a string, count how many substrings of exactly length 3 contain at least one vowel (both lowercase and uppercase vowels count).

Algorithms & Data Structures
Author's notes

My first instinct was to just check each length-3 window and see if any character is a vowel.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Clarify the problem constraints (e.g., string length, character set) and edge cases, then propose an efficient sliding window solution that checks each length-3 window for vowels in O(n) time. Discuss trade-offs between brute force and optimized approaches, and write clean code with clear variable names.

Pro tip: At Hudson River Trading, interviewers value clean, efficient code and the ability to discuss time/space complexity upfront. Mention that you'd handle edge cases like strings shorter than 3 characters and consider Unicode if relevant, but stick to ASCII for simplicity unless specified.

1. Clarify requirements and constraints

Ask about input size, character set (ASCII vs Unicode), and whether overlapping substrings count. Confirm that 'at least one vowel' includes both lowercase and uppercase.

2. Outline approach and complexity

Propose a sliding window of size 3 to scan the string once, maintaining a count of vowels in the current window. State that this yields O(n) time and O(1) space.

3. Walk through an example

Trace the algorithm on a small example like 'abcde' to demonstrate correctness and edge cases (e.g., no vowels, all vowels).

4. Implement the solution

Write code with a helper function to check if a character is a vowel. Use a loop to slide the window, updating the vowel count and incrementing the result when count > 0.

5. Test and discuss edge cases

Test with strings of length < 3, strings with no vowels, and strings with all vowels. Mention potential optimizations or alternative approaches if asked.

Key Points to Mention

  • Time complexity: O(n) with a single pass using sliding window; space complexity: O(1).
  • Handling both lowercase and uppercase vowels by converting to lowercase or using a set of characters.
  • Edge cases: string length less than 3, empty string, no vowels, all vowels.
  • Overlapping substrings are counted separately (e.g., 'aaa' has one substring of length 3).
  • Use of a helper function for readability and maintainability.
  • Potential alternative: brute force O(n*3) which is effectively O(n) but less efficient in practice due to repeated checks.

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