Trains the technique from
LeetCode 1Two SumThis is an original problem, written from a brief that listed the technique, the difficulty, the topics, the function shape and the input bounds — none of that problem's wording, examples, hints or editorials. The link is there so you can map your practice onto the standard set.
Same function shape, different story and different numbers.
An accountant is closing out a ledger. You are given an integer array adjustments, where each entry is a signed correction applied to an account, and an integer net.
Exactly one pair of entries sums to net. Return the indices of those two entries, in any order. An entry cannot be paired with itself.
Example 1
The entry at index 1 holds -3 and the entry at index 2 holds 11, which together settle to 8.
Example 2
Both entries hold the same amount but occupy separate positions, so pairing them is allowed.
Example 3
With only two entries available, they must be the settling pair.
The values you return may be in any order.
The editor is preloaded with this. It matches the parent problem's shape, so a solution that works here transfers to a judge unchanged.
def reconcile_ledger(adjustments: list[int], net: int) -> list[int]:public int[] reconcileLedger(int[] adjustments, int net)See the step-by-step animation, the intuition, and clean code in every language — free, no credit card.