Read this first — it is the point of the contest
A hash map answers "have I seen this before, and where?" in constant time. Almost every problem that looks like it needs two nested loops is really asking you to remember what you have already seen.
The brute-force shape:
for i in range(n): # O(n²)
for j in range(i + 1, n):
if nums[i] + nums[j] == target:
return i, j
The hash-map shape:
seen = {} # O(n)
for i, x in enumerate(nums):
if target - x in seen:
return seen[target - x], i
seen[x] = i
dict.get(key, default) saves you a branch.Five problems, each a different face of the same idea. Solve them in order — they build.
Nobody on the board yet
Earn XP by finishing lessons, solving problems and reviewing — the first people to do so appear here.
Contest points are awarded for solutions written in the editor. We record how much of each submission was typed versus pasted — a pasted solution still counts as solved for your own learning, but it does not score here. This is stated up front so nobody is caught out.