flowchart TD
A[Set left and right] --> B{left right}
B -- No --> C[Stop]
B -- Yes --> D[Compute current metric]
D --> E{matches target}
E -- Yes --> F[Record answer]
E -- No --> G{too small too large}
G -- too small --> H[left]
G -- too large --> I[right]
H --> B
I --> B
F --> B
sequenceDiagram
participant L as left ptr
participant R as right ptr
participant A as array
L->>A: read arr left
R->>A: read arr right
A-->>L: compare sum
L->>L: move inward
R->>R: move inward