Running Scan / Prefix-Suffix · Prefix-suffix accumulation
Best Time to Buy and Sell Stock
LeetCode 121 · Module: Arrays & Hashing
The scenario
you are processing a stream of events and need fast memory of what has already happened — a seen value, a running count, or a reusable prefix state.
What you'll learn
- How to recognize the Running Scan / Prefix-Suffix pattern from the problem statement.
- The BASIC Framework breakdown for this problem.
- A clean, interview-ready Python solution with time/space analysis.
Full video, code, and the workspace are part of PatternMastery Pro — 500 problems for one $9.99 payment.