← Hudson River Trading Interview Insights

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

Intermediate
Apr 2026

Summary

HRT coding interview with a simulation-style problem involving watchers and players on a 1D array. Pretty niche problem that felt more like a competitive programming puzzle than a typical algo question.

Questions Asked (1)

Q1

Given a 1D array of length L, watchers and players move at speed 1 per unit time. Watchers start facing left and reverse direction at given (unsorted) timestamps. A player is frozen whenever a watcher occupies the same position. Return how many players successfully reach position L by time T.

Algorithms & Data StructuresSystem Design
Author's notes

The unsorted timestamps thing tripped me up at first, I just assumed they'd be sorted and almost skipped the sort step entirely.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

First, clarify the problem details and constraints, then model each watcher's position over time as a piecewise linear function. For each player, determine if their path intersects any watcher's path, and if so, compute the earliest blocking time; otherwise, they reach L at time L. Count players whose arrival time ≤ T.

Pro tip: Watch out for simultaneous events and boundary conditions (e.g., watchers reversing exactly when a player arrives). Also, sorting the watcher reversal timestamps first simplifies the piecewise function construction.

1. Clarify the problem

Ask about the number of watchers and players, whether watchers can overlap, and if players start at position 0 at time 0. Confirm that watchers reverse instantly at given timestamps.

2. Model watcher movement

Sort the reversal timestamps. For each watcher, construct a function w(t) giving its position at time t, considering initial leftward movement and direction changes at each timestamp.

3. Determine player blocking

For a player starting at 0 at time 0, check if there exists t ≥ 0 such that w(t) = t (player's position). If so, find the earliest such t; the player is frozen from then on and never reaches L.

4. Count successful players

If no blocking occurs, the player reaches L at time L. Count players for whom L ≤ T. Return the count.

Key Points to Mention

  • Sorting the reversal timestamps to handle unsorted input.
  • Piecewise linear representation of watcher positions.
  • Solving w(t) = t to find intersection times.
  • Handling simultaneous events (e.g., watcher reverses exactly when player arrives).
  • Time complexity: O((W + P) log W) after sorting, where W is number of watchers and P is number of players.
  • Edge cases: watchers starting at position 0, multiple watchers, T < L.

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