Two Pointers
21 / 170Two PointersLesson 6 of 6About 48 min
Two problems rebuilt cold, plus the discrimination that decides which tool a new problem wants.
You now have two ways to find a pair with a property: a hash map from Unit 1, and converging pointers from this unit. They are not interchangeable, and picking wrong is the most common way this material fails to transfer.
An unsorted array of prices, and you must return the positions of two prices summing to a budget. The array can hold a million entries. Which approach fits best?
You have solved this one before. Rebuild it from scratch without looking at your old submission. If the approach does not come back within a few minutes, that is the signal that it needs another pass.
You have solved this one before. Rebuild it from scratch without looking at your old submission. If the approach does not come back within a few minutes, that is the signal that it needs another pass.