LC 4

Median of Two Sorted Arrays

Hard · LC 1–100

arraybinary-searchdivide-and-conquer
Free

Candidate solution routes

Primary

Binary Search on a Sorted Domain

Free

Invariant: At loop entry, an existing target lies inside closed interval [lo,hi]; every outside index has been disproved by sorted comparisons.

candidate confidence: 0.502 · metadata_only

Alternate 1

Divide, recurse, and combine

Free

Invariant: solve(lo,hi) returns a complete summary conforming to its domain contract; combine depends only on child summaries and accounts for every cross-domain contribution exactly once.

candidate confidence: 0.630 · metadata_only

Alternate 2

Binary-Search Boundary / First True

Free

Invariant: The first True always lies in [lo,hi]; indexes left of lo are proven False, while hi remains a feasible candidate.

candidate confidence: 0.476 · metadata_only

Alternate 3

Binary Search on the Answer

Free

Invariant: The closed interval [lo,hi] contains the optimum boundary; for first True, values left of lo are excluded and hi remains a feasible candidate.

candidate confidence: 0.452 · metadata_only

How to use this page

Read the statement and constraints first, then validate recognition signals, invariant, and complexity. Candidate score is not correctness evidence.