Available question text
Process nums left-to-right to build arr1 and arr2: for each nums[i], append it to the array that currently has fewer elements strictly greater than nums[i] (ties broken by smaller length, then arr1), and return arr1 concatenated with arr2. The key challenge is maintaining dynamic counts of elements greater than a value in each multiset efficiently to support large n.
Related questions
Continue with questions that share topics or the same question type.
- Distribute Elements Into Two Arrays I
Coding
- Find Common Elements Between Two Arrays
Coding
- Partition Array Into Two Arrays to Minimize Sum Difference
Coding · Array · Binary Search · Bit Manipulation
- All Elements in Two Binary Search Trees
Coding
Sources · 1 reference
These records explain where the question appears. A company tag or candidate report does not guarantee a future interview question.
Hello Interview · 1 record
No company association
Leetcode 3072. Distribute Elements Into Two Arrays II
Reported date not specified · 0 source reports
Source snapshot: Nov 12, 2026
View source