Skip to main content

Arrays, strings and hash maps

Use arrays, strings and hash maps to solve counting, lookup and grouping problems in one pass, and recognise the interview patterns that need them.

Beginner 3 · Data and toolsabout 2 hours5 sections

Quick answer

Arrays store items in order and read by position in O(1). Hash maps such as Python dicts find values by key in O(1) on average, which turns many O(n²) problems into O(n).

Why it matters

Arrays and hash maps solve most everyday data problems, from counting orders to matching records. They are also the first topic in almost every coding interview, and the usual way to turn an O(n²) answer into O(n).

Sign up free to read the whole lesson

The rest of this lesson: 5 parts, video lessons, the best course, practice and a quick check. It is free, takes a few seconds and needs no card.

Accounts are for learners aged 18 and over. Under 18? The quick answer and the first part of every lesson stay open: browse lessons by topic.

Data structures and algorithmsBeginner 3: Data and toolsVideo lessonsArrayHash mapBig-O notation

Track

Today's AI turns are used

Lessons, roadmaps, videos, practice cards and the code playground stay free with your account, with no limit.