← Hudson River Trading Interview Insights

Hudson River Trading·Software Engineer·Technical Phone Screen·Intermediate

Intermediate
May 2026

Summary

Interviewed for a software engineer role at Hudson River Trading and got a string splitting problem that looked deceptively simple. The suffix dependency on total part count is what makes it actually interesting.

Questions Asked (1)

Q1

Given a message string and a character limit, split the message into ordered parts where each part ends with a suffix like '<X/Y>' (X = part number, Y = total parts), and every part including its suffix fits within the limit. Return an empty result if no valid split exists.

Algorithms & Data StructuresTechnical Trade-offs
Author's notes

The tricky part is that the suffix length depends on Y, which you don't know until you've decided how many parts to use.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Start by clarifying edge cases and constraints, then propose a solution that first determines the number of parts by solving for the smallest Y such that the message can be split into Y parts each fitting within the limit including the suffix. Use a greedy approach to split the message into Y parts, ensuring each part is as large as possible while leaving enough room for the remaining parts, and validate the final split.

Pro tip: Mention that the suffix length depends on the total number of parts, so you need to iterate or binary search on Y, and that the greedy split from left to right works because the suffix format is fixed and the limit is uniform.

1. Clarify requirements and edge cases

Ask about the suffix format, whether the message can be empty, what characters are allowed, and if the limit includes the suffix. Confirm that parts must be contiguous and in order.

2. Determine the number of parts

Find the smallest Y such that the message can be split into Y parts each fitting within the limit. This can be done by iterating Y from 1 upwards and checking feasibility, or by binary search if monotonic.

3. Greedily split the message

For the chosen Y, split the message from left to right, making each part as long as possible while ensuring the remaining message can be split into the remaining parts within the limit.

4. Validate and return

Check that each part with its suffix fits within the limit and that all parts concatenate to the original message. If any part fails, return an empty result.

Key Points to Mention

  • The suffix length varies with the total number of parts, so the number of parts must be determined before splitting.
  • A greedy approach works because the suffix format is fixed and the limit is uniform; taking the maximum possible characters for each part leaves the most room for subsequent parts.
  • Feasibility check: for a given Y, the message length must be at most Y * (limit - suffix_length(Y)), and also each part must have at least 1 character (or 0 if empty parts allowed).
  • Time complexity: O(Y * n) for naive iteration, but can be optimized to O(n) by computing Y directly or using binary search.
  • Edge cases: message empty, limit too small to fit even one character plus suffix, or no valid split exists.
  • Trade-offs: between simplicity of implementation and efficiency; consider if the message is very large, binary search on Y is better.

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