Lessons
C++ · Ready-made Containers · 41. Two Pointers

step 1 of 7

A finger on each end

Two pointers are two positions in one list: lo on the first number, hi on the last.

The last position is the size minus 1, because I count from 0.

Mission

Move lo one step right and hi one step left, then print.

PIP·1
main.cppyour code
1
2
3
4
5
6
7
8
9
10
11
← press me!
readyscreen

Press RUN to see what this program does.

Do the mission and Next turns green.

Two Pointers