Single passes, sums, maxima and sorting. The foundation for everything.
Key ideas
- Most questions finish in one pass: carry what you need (a sum, the largest, the smallest) in a variable as you go.
- Every read counts. Keep a value instead of reading the same element twice.
- Sorted? Comparing neighbours is enough.
Pattern
best = None
for v in values:
if best is None or v > best:
best = vLessons
Each lesson explains one idea from zero and ends with a few tasks. Lessons open in order; the explanation can be read at any time.
Boss
07
Best Trade
Function
The boss opens when every lesson of the topic is finished. Solve it too and the topic is complete, and the topics after it open.