Lowest Number in an Open Range
Reported by candidates from Hudson River Trading's online assessment. Pattern, common pitfall, and the honest play if you blank under the timer.
Hudson River Trading reportedly served this one in September 2026, and it looks like a freebie. It's a single pass over an array with a strict range filter. The catch is in the word "strictly," and in what you return when nothing qualifies. If your OA invite is sitting in your inbox, this is the kind of problem where a sloppy comparison costs you the whole thing. Endpoints are excluded, equal endpoints are legal, and 0 is the sentinel. StealthCoder sits invisibly on your screen during the live OA as a safety net if you blank, but you won't need it once you read the next paragraph.
The problem
You are given an array of positive integers numbers and a two-element array nRange describing a number range whose endpoints satisfy nRange[0] ≤ nRange[1]. Return the smallest value in numbers that lies strictly between the two endpoints. In other words, find the smallest numbers[i] such that nRange[0] < numbers[i] < nRange[1]. If no value satisfies both strict inequalities, return 0. Function findLowestInRange(numbers: int[], nRange: int[]) → int Examples Example 1 numbers = [11,4,23,9,10] nRange = [5,12] return = 9 The values strictly between 5 and 12 are 11, 9, and 10. Their minimum is 9. Example 2 numbers = [1,3,2] nRange = [1,1] return = 0 No integer can be strictly greater than 1 and strictly less than 1 at the same time, so the result is 0. Example 3 numbers = [7,23,3,1,3,5,2] nRange = [2,7] return = 3 The qualifying values are 3, 3, and 5. The smallest is 3. Constraints 1 ≤ numbers.length ≤ 100 1 ≤ numbers[i] ≤ 100 nRange.length = 2 Both values in nRange are positive integers that fit in a signed 32-bit integer. nRange[0] ≤ nRange[1]
Reported by candidates. Source: FastPrep
Pattern and pitfall
The pattern is a linear scan with a running minimum. Walk the array, keep any value where nRange[0] < x < nRange[1], and track the smallest. The edge case that breaks naive solutions is using <= instead of <. Example 3 shows it: with range [2,7], the values 2 and 7 must be excluded, so the answer is 3, not 2. Example 2 covers the other trap, where both endpoints are equal, so nothing can qualify and you return 0. Don't initialize your minimum to 0, or you'll return 0 even when matches exist. Use a large sentinel like infinity or a null flag, then convert to 0 at the end. Duplicates don't matter. It's O(n) time and O(1) space. If you freeze on the live OA, StealthCoder is the hedge that hands you this loop in seconds.
Drill it cold or hedge it with StealthCoder. Either way, don't walk into the OA hoping you remember the trick.
You can drill Lowest Number in an Open Range cold, or you can hedge it. StealthCoder runs invisibly during screen share and surfaces a working solution in under 2 seconds. The proctor sees the IDE. They don't see what's behind it. Made for the candidate who got the OA invite this morning and has 72 hours, not six months.
Get StealthCoderRelated leaked OAs
You've seen the question.
Make sure you actually pass Hudson River Trading's OA.
Hudson River Trading reuses patterns across OAs. Made for the candidate who got the OA invite this morning and has 72 hours, not six months. Works on HackerRank, CodeSignal, CoderPad, and Karat.
Lowest Number in an Open Range FAQ
How hard is the Hudson River Trading lowest-in-range question really?+
It's easy on algorithms and unforgiving on details. One pass, no data structures. The risk is off-by-one on the strict inequalities and the empty-result case. Candidates who lose points here usually wrote <= or initialized the minimum to 0. Read the examples and you're fine.
What's the trick to this problem?+
Filter with strict comparisons, track a minimum, and return 0 if nothing matched. Start the minimum at a sentinel larger than any possible value, such as 101 given the constraints, or use a found flag. Then check the sentinel at the end.
What happens when nRange has equal endpoints?+
Nothing can satisfy x > a and x < a at once, so the loop never matches and you return 0. Example 2 tests exactly this. You don't need special-case code if your sentinel logic is correct, but it's worth confirming mentally.
Do I need to sort the array?+
No. Sorting costs O(n log n) and adds nothing here. A single scan with a running minimum is cleaner and faster. With n at most 100 either works, but the scan has fewer ways to go wrong, especially with duplicates.
How do I prepare for this in 48 hours?+
Write the function from scratch three times, then test the cases: both endpoints excluded, equal endpoints, all values outside the range, and duplicates. Also practice similar filter-and-aggregate loops so strict versus inclusive bounds becomes a reflex before the OA.