Skip to content
CodeItRaw
Path

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 = v

Lessons

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.

  1. 01

    Index and slice

    0/3 tasks

  2. 02

    One pass

    0/3 tasks

  3. 03

    Comparing neighbours

    0/3 tasks

  4. 04

    Carrying two things at once

    0/3 tasks

  5. 05

    Building a new list

    0/3 tasks

  6. 06

    Running totals

    0/3 tasks

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.