FastPrepSimpleRDD Multiset Intersection
Problems/SimpleRDD Multiset Intersection

SimpleRDD Multiset Intersection

DatologyAI logoDatologyAI● EasyFULLTIMEPHONE SCREEN
QuestionFunctionExamplesConstraints

Problem statement

Source note: The interview report explicitly demonstrates multiplicity-preserving intersection for a SimpleRDD. Preserving left-input order makes the collected batch deterministic.

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.

More DatologyAI problems

  • Multiline Text Editor with Cursor MovementPHONE SCREEN · Seen Oct 2026
  • SimpleRDD Word CountPHONE SCREEN · Seen Sep 2026
See DatologyAI hiring insights
Saved
class Solution {
    public int[] simpleRddIntersection(int[] left, int[] right) {
        // Write your solution here.
    }
}
Checking account…