Two Pointers

    Two Pointers — Pair Sum

    Move two pointers inward on a sorted array to find a target sum.

    target
    Start — L=0, R=7, target=14
    L
    1
    0
    3
    1
    4
    2
    6
    3
    8
    4
    11
    5
    15
    6
    R
    20
    7
    sum = 21  ·  target = 14
    Step 0/8