Implement prototype(weights: list[int], target: int) -> tuple[int, int] | None and solve with the same signature. Return the lexicographically smallest ascending value pair (a, b) with a+b == target, drawn from distinct input positions. Return None if no pair exists. Negative integers and duplicates are valid.

Examples: ([4, 1, 3, 2], 5) returns (1, 4); ([5], 10) returns None; ([5, 5], 10) returns (5, 5).

Prototype: test all pairs. Final: sort a copy and use inward pointers, targeting O(n log n) time and O(n) space. Preserve the original list; no additional errors are required.

Drag or use the arrow keys to resize. Home collapses the question; End collapses the editor. Enter or double-click resets the split.
Loading editor…
No results yet.

Complete the starter code, then run the checks.
Results and errors will appear here.