# puzzle gauntlet advanced

Two Sum, Turbo Mode

Same gift card puzzle — but now the store has THOUSANDS of toys, and checking every pair is too slow. The dict trick makes one single pass enough. ⚡

You get the prices and the target (exactly one pair works). Print the POSITIONS of the two toys, smaller position first, separated by a space. As you walk the list, remember each price's position in a dict — and before storing, ask: is my perfect partner already in there?

Example:

Input: prices = [3, 9, 4, 6], target = 10 Output: 2 3

Walking the list, by the time we reach position 3 (price 6), its needed partner (10 - 6 = 4) is already stored in the dict at position 2 — a one-pass hit.

💡 need a hint?

pg-two-sum-turbo.py🔒 given lines are locked — write your code in between
loading...