Skip to main content
⚑
← Coursesβ€ΊInterview PrepModule 1 Β· Big-O & Easy Patternsβ€ΊTwo pointers: pair sumwrite2 / 104
+75 XP
Task
πŸ“ **Task:** Write `pair_sum_sorted(arr, target)` that returns `[i, j]` (indices) of the first pair in the sorted list `arr` that sums to `target`, or `[]` if no such pair exists. Then test with `pair_sum_sorted([1, 2, 4, 7, 11], 9)` and print the result. πŸ“‹ Implement the function above. Test cases run automatically. πŸ’‘ **Hint:** Re-read the theory if you get stuck β€” the pattern is right there.
✏️ Write your code here
🐍
Loading Python...
One-time download (~1 MB). Then it runs instantly.
πŸ“Š Result
Press Run to see result...