PracHub
QuestionsCoachesLearningGuidesInterview Prep

Quick Overview

This Hudson River Trading coding question focuses on queue simulation for a single-server process with arrival times and task durations. It helps candidates practice event ordering, completion-time accounting, and the kind of deterministic reasoning expected in low-latency engineering interviews.

  • medium
  • Hudson River Trading
  • Coding & Algorithms
  • Software Engineer

Calculate Completion Time for a Single-Server Reactor Queue

Company: Hudson River Trading

Role: Software Engineer

Category: Coding & Algorithms

Difficulty: medium

Interview Round: trading - 网上海投 - 在线笔试

A laboratory has one molecular reactor. Each accepted sample takes exactly 5 minutes to process. Samples arrive throughout the day at integer timestamps in seconds. Waiting samples are stored in a cooling chamber. The reactor can process one sample at a time. The cooling chamber can hold at most 10 waiting samples, not counting the sample currently being processed. If a new sample arrives when the cooling chamber already has 10 waiting samples, that new sample is rejected. If a sample arrives at the exact same time another sample completes processing, the first sample already waiting in the cooling chamber starts next, and the newly arrived sample waits in the chamber. Given the arrival times, return the time in seconds when all accepted samples have completed processing. You may assume arrival times are sorted in nondecreasing order. Example: ```text times = [0, 60, 120] output = 900 ``` Each accepted sample takes 300 seconds. The third sample completes at time 900. Constraints: - `0 <= times.length <= 100000` - `0 <= times[i] <= 10^9` - Processing time is always 300 seconds. - The cooling chamber capacity rule applies only to samples waiting, not the sample currently in the reactor.

Quick Answer: This Hudson River Trading coding question focuses on queue simulation for a single-server process with arrival times and task durations. It helps candidates practice event ordering, completion-time accounting, and the kind of deterministic reasoning expected in low-latency engineering interviews.

Samples arrive at sorted timestamps. One reactor processes one accepted sample at a time, taking 300 seconds. At most 10 samples may wait in the cooling chamber, excluding the sample being processed. Arrivals beyond that capacity are rejected. Return when all accepted samples finish.

Constraints

  • 0 <= times.length <= 100000
  • 0 <= times[i] <= 10^9
  • times is sorted nondecreasing
  • Processing time is 300 seconds
  • Cooling chamber capacity is 10 waiting samples.

Examples

Input: ([0, 60, 120],)

Expected Output: 900

Input: ([],)

Expected Output: 0

Input: ([0],)

Expected Output: 300

Input: ([0, 300],)

Expected Output: 600

Input: ([0, 300, 300],)

Expected Output: 900

Input: ([0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11],)

Expected Output: 3300

Input: ([0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12],)

Expected Output: 3300

Input: ([0, 1000, 1001],)

Expected Output: 1600

Input: ([0, 0, 0, 0],)

Expected Output: 1200

Hints

  1. Process completions up to the arrival time before accepting that arrival.
  2. If a completion and arrival happen at the same time, an already waiting sample starts before the new arrival waits.
  3. Rejected samples do not enter the queue.
Last updated: Jul 2, 2026

Loading coding console...

PracHub

Master your tech interviews with 8,000+ real questions from top companies.

Product

  • Questions
  • Learning Tracks
  • Interview Guides
  • Resources
  • Premium
  • For Universities
  • Student Access

Browse

  • By Company
  • By Role
  • By Category
  • Topic Hubs
  • SQL Questions
  • AI Coding Questions
  • Compare Platforms
  • Discord Community

Support

  • support@prachub.com
  • (916) 541-4762

Legal

  • Privacy Policy
  • Terms of Service
  • About Us

© 2026 PracHub. All rights reserved.

Related Coding Questions

  • Count Digit-Reversal Equivalent Pairs - Hudson River Trading (medium)
  • Count Length-3 Chat Substrings with a Vowel - Hudson River Trading (medium)
  • Simulate Alternating Stick Collection for a Nest - Hudson River Trading (medium)
  • Test easy–medium array/string tasks - Hudson River Trading (Medium)
  • Approach verbose data-structure design - Hudson River Trading (Medium)