Reported September 2026
DatologyAIhash table

SimpleRDD Multiset Intersection

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

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

Inputs up to 200000 elements each means the nested-loop version dies before it finishes. That's the whole story of the DatologyAI OA reported in September 2026, SimpleRDD Multiset Intersection. You get two integer arrays and return each shared value as many times as its minimum frequency, keeping the left order. It's a hash-table counting problem dressed in Spark-ish naming. If you blank on the setup, StealthCoder can run as a safety net during the live OA, but the logic below is short enough to own tonight.

The problem

Return the multiset intersection of two integer collections. A value appears in the result as many times as the minimum of its frequencies in the two inputs.
Preserve the order of qualifying occurrences from left.

Function
simpleRddIntersection(left: int[], right: int[]) → int[]

Examples
Example 1
left = [1,3,3]
right = [3,4,3]
return = [3,3]
The value 3 occurs twice in both inputs.
Example 2
left = [4,9,5,9]
right = [9,4,9,8]
return = [4,9,9]
Qualifying occurrences retain their order from the left input.
Example 3
left = []
right = [1,2]
return = []
An empty input has an empty intersection.

Constraints
0 <= left.length, right.length <= 200000.
Each value fits in a signed 32-bit integer.

Reported by candidates. Source: FastPrep

Pattern and pitfall

Build a frequency map of the right array. Then walk the left array in order. For each value, if its count in the map is above zero, append it to the result and decrement the count. That single pass gives you min(freqLeft, freqRight) occurrences per value, and the order comes from the left for free. Time is O(n + m), space is O(m). The common pitfall is counting both arrays and then trying to rebuild the order afterward, which is extra work and easy to get wrong. Another trap is removing items from the right list one by one, which turns it into O(n*m). Edge cases: either input empty returns empty, and duplicates in the left beyond the right count must be dropped. Values are 32-bit, so a plain hash map works. If you freeze in the live OA, StealthCoder is the hedge that surfaces this decrement-the-counter approach fast.

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 SimpleRDD Multiset Intersection 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

⏵ Practice the LeetCode equivalent

This OA pattern shows up on LeetCode as intersection of two arrays ii. If you have time before the OA, drill that.

⏵ The honest play

You've seen the question. Make sure you actually pass DatologyAI's OA.

DatologyAI 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.

SimpleRDD Multiset Intersection FAQ

What's the trick in SimpleRDD Multiset Intersection?+

Count the right array in a hash map, then scan the left array once. Whenever a value has a positive count, add it to the output and decrement the count. That caps each value at its minimum frequency and preserves left order without any sorting.

Why does brute force fail here?+

Both arrays can hold 200000 elements. Checking each left value against the right array, or deleting matches from a list, is O(n*m), which is around 40 billion operations in the worst case. A hash map brings it to linear time.

Do I need to sort anything?+

No. Sorting would break the left-order requirement or force you to re-map positions. A counter map plus one left-to-right pass handles both the frequency cap and the ordering.

Which edge cases should I test before submitting DatologyAI's version?+

Test an empty left, an empty right, no overlap, all duplicates like [2,2,2] against [2], and negative or extreme 32-bit values. Also check that the left has more copies than the right, since extras must be dropped.

How do I prepare for this in 48 hours?+

Write the frequency-map-and-decrement pattern from memory a few times in your language. Then do two or three related counting problems, like intersection of two arrays II. The pattern is small, so fluency matters more than volume.

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

OA at DatologyAI?
Invisible during screen share
Get it