Mixed Practice in Python
Chapter 62: Mixed Practice
4 short lessons, with 3D animations, quizzes and coding tasks.
The lessons
Problem set 1: arrays and hashing
For every problem, read the clues and the limits first (Lessons 61.1–61.2), name the pattern before writing code, start with a brute force if you are unsure, and test the edge cases (Lesson 61.4).
Problem set 2: two pointers, windows and prefix sums
When the items sit in a row, two pointers walk in from the ends, a window slides along keeping a running total, and a prefix sum list answers any range total by one subtraction.
Problem set 3: stacks, binary search and trees
Clues that point backwards to "the last thing still waiting" suggest a stack, a yes/no question that flips only once as a number grows suggests binary search on the answer, and anything shaped like branching routes from one start suggests recursion on a tree.
Problem set 4: graphs, heaps, greedy and DP
Something that spreads one step at a time from several places at once is a BFS, "the k nearest/smallest" is a heap, and a series of choices calls for greedy only if you can show the local choice is always safe; otherwise use DP.