CodeMentor.
Ask AIProblemsLearnC++TCSCore CSHRProgress
0Lv 1
ProblemsTwo Pointers

Two Sum II (Sorted)

Medium
LeetCode
5/7
MediumTwo PointersLeetCode #167

Two Sum II

1-indexed sorted array. Two pointers from ends — no hash needed.

Examples

Example 1

Input

4 9
2 7 11 15

Output

1 2
Example 2

Input

3 6
2 3 4

Output

1 3

Stuck? Take a nudge

C++17Autosaves