Code
Loading editor...
Tap Analyze to see visualization
Click Analyze to visualize
See step-by-step execution, variables, and output
Variables
Run code to see variables
Output
Console output will appear here
Click Analyze to visualize
See step-by-step execution, variables, and output
Run code to see variables
Console output will appear here
Ensure nums1 is the shorter array. Binary search on the partition index i of nums1, compute j for nums2 so the left half has exactly half the total elements. Valid partition means max(left sides) <= min(right sides).
Binary search on where to partition the smaller array. The combined partition must have exactly half the total elements, and max of left side must be less than or equal to min of right side.
Updated Feb 2026