Traversing an array means visiting its elements one by one. It's the single most common thing you'll do with an array, and there are only a handful of shapes a traversal can take. Learn them once and you'll recognise them in every solution.
The classic loop. Use it when you need the position as well as the value — to compare neighbours, to write to another array, or to report where something is.
Free account
Sign up to read the rest of this lesson: 6 more sections, a dry-run simulator and code in JavaScript, Python, Java and C++.
Still to come