Reported September 2026
Hudson River Tradingcounting

Round-Robin WDL Order

Reported by candidates from Hudson River Trading's online assessment. Pattern, common pitfall, and the honest play if you blank under the timer.

Get StealthCoderRuns invisibly during the live Hudson River Trading OA. Under 2s to a working solution.
Founder's read

The mistake that sinks a first attempt on this Hudson River Trading OA, reported in September 2026, is sorting the string and calling it done. Sorting gives you WWWDDDLLL, not WDLWDLWDL. This one is a counting problem dressed up as a sorting problem. You tally W, D, and L, then emit them in rounds until every count hits zero. It's short, and the traps are small. If you blank on the loop shape during the live assessment, StealthCoder runs invisibly as a safety net and hands you the structure fast.

The problem

Given a string inputStr containing only W, D, and L, build a reordered string by consuming the available characters cyclically in this order:
Append W if any W characters remain.
Append D if any D characters remain.
Append L if any L characters remain.
Repeat this cycle until every input character has been consumed. When a character is exhausted, skip it in later cycles while continuing to consume the other characters in the same cyclic order.
Return the reordered string.

Function
solution(inputStr: String) → String

Examples
Example 1
inputStr = "LDWDL"
return = "WDLDL"
The first round appends W, then D, then L. The remaining D and L are appended in that order during the next round.
Example 2
inputStr = "WWWLLDDLD"
return = "WDLWDLWDL"
There are three copies of each character, so three complete W, D, L rounds consume the string.
Example 3
inputStr = "LLLL"
return = "LLLL"
Every round skips W and D, then appends one remaining L.

Constraints
Every character in inputStr is W, D, or L.

Reported by candidates. Source: FastPrep

Pattern and pitfall

The trick is counting, not sorting. Build three counters for W, D, and L. Then loop while any counter is above zero. Inside each pass, check W, then D, then L in that fixed order. If the counter is positive, append the character and decrement. If it's zero, skip it and keep going. That skip rule is exactly what handles the LLLL case and the uneven case like LDWDL. The common pitfall is sorting first or using a fixed number of rounds. Another is breaking out of the loop when one counter empties, which drops the rest of the string. Use a list or StringBuilder for output instead of repeated string concatenation. Time is O(n), space is O(n) for the result. If your head locks up on the nested loop, StealthCoder is the hedge during the live OA, but the logic here is only about ten lines.

If this hits your live OA and you blank, StealthCoder solves it in seconds, invisible to the proctor.

If this hits your live OA

You can drill Round-Robin WDL Order 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. Built by an Amazon engineer who would have shipped this the night before his JPMorgan OA if he'd had it.

Get StealthCoder

Related leaked OAs

⏵ The honest play

You've seen the question. Make sure you actually pass Hudson River Trading's OA.

Hudson River Trading reuses patterns across OAs. Built by an Amazon engineer who would have shipped this the night before his JPMorgan OA if he'd had it. Works on HackerRank, CodeSignal, CoderPad, and Karat.

Round-Robin WDL Order FAQ

What's the trick in the Round-Robin WDL Order problem?+

Count each character, then run rounds. In every round, append W, D, L in that order if its count is above zero and decrement. Stop when all three counts are zero. Don't sort the string, because sorting groups characters instead of interleaving them.

How hard is this Hudson River Trading question really?+

It's easy on algorithm difficulty. There's no clever data structure. The risk is rushing and misreading the skip rule. Trace the three examples by hand before you submit, especially LLLL and LDWDL, and you'll catch the usual bugs.

What's the time and space complexity?+

Time is O(n) because each character is appended exactly once, and the number of rounds is at most the largest count. Space is O(n) for the output plus O(1) for the three counters. Use a list or builder to avoid quadratic string concatenation.

What edge cases should I test?+

Test a string with only one character type like LLLL, a string missing one type, a single character, and uneven counts like WWWLLDDLD variants. Also check that the output length equals the input length. Empty input may not be allowed, but return an empty string if it appears.

How do I prepare for this in 48 hours?+

Practice frequency-count problems where you rebuild a string in a custom order. Write this one from scratch twice without notes. Focus on the loop condition, which is while any count remains, and on the skip logic. That covers nearly everything this problem tests.

Problem reported by candidates from a real Online Assessment. Sourced from a publicly-available candidate-aggregated repository. Not affiliated with Hudson River Trading.

OA at Hudson River Trading?
Invisible during screen share
Get it