Week 0 · before week 1

Week 0: on-ramp

Before week 1, take a week or three to make sure you are ready and set up. This path is hard. That is fine, it is supposed to be. But it should be hard because Knuth is hard, not because you are fighting Java syntax or git at the same time. Take the quiz honestly, fill any gaps with the free resources below, and do the setup checklist.

Setup checklist

Sign up to tick these off; some tick themselves.

  1. Create a GitHub account and sign in with itAutomatic

    Your progress is verified from a public GitHub repo, so cracked.guide needs to know which account is yours.

    1. Create a free account at github.com if you do not have one.
    2. Sign in to cracked.guide with GitHub, or link GitHub in Settings if you signed up with email or Google.
  2. Pick your start date and paceAutomatic

    Every week on the path is dated from your start date. Pick a Monday you can actually commit to.

    1. Choose a start date (a Monday works best).
    2. Choose your pace. Budget roughly 8 to 12 hours a week at the standard pace.
    3. Be honest about holidays and busy months; you can shift later, but a realistic start beats a heroic one.
  3. Install a JDK and a C compiler

    jlox is Java and clox is C. Both toolchains are free.

    1. Install a JDK: Eclipse Temurin 21 (LTS) from adoptium.net.
    2. macOS: run xcode-select --install to get the Xcode Command Line Tools (clang).
    3. Linux (Debian/Ubuntu): sudo apt install build-essential.
    4. Windows: install WSL and then build-essential inside Ubuntu (recommended), or install MSYS2 for a native gcc.
    5. Verify in a new terminal: java -version shows 21 (or newer) and cc --version prints a compiler version.
  4. Create your public lox repoAutomatic

    One repo holds both interpreters, and cracked.guide runs the official tests against it.

    1. On GitHub, create a new public repository named lox.
    2. Clone it, then create two folders: jlox/ and clox/.
    3. Add a short README and push.
  5. Add the cracked.guide workflow and .cracked.jsonAutomatic

    The workflow runs the Crafting Interpreters test suite on every push and reports which chapters pass.

    1. Open the Verify page and copy the workflow file into .github/workflows/ in your lox repo.
    2. Add the .cracked.json file from the same page at the repo root.
    3. Commit, push, and check that the Actions tab shows a run.
  6. Set your LeetCode usernameAutomatic

    Your two NeetCode 150 problems a week are checked from your public LeetCode profile.

    1. Create a free LeetCode account if you do not have one.
    2. Enter your LeetCode username on the Verify page.
    3. Note: 7 of the NeetCode 150 are LeetCode Premium-only. Solve those on neetcode.io for free; you do not need Premium.
  7. Get the books

    Crafting Interpreters is free online. TAOCP is not, but you do not need it until week 17, and there are cheap and free legal ways to get it.

    1. Bookmark craftinginterpreters.com.
    2. Decide how you will get TAOCP Vol 1 by week 17: library, used, or new. The gear page lists the options.
  8. Get the Zachtronics games

    TIS-100 starts in week 1. Shenzhen I/O and EXAPUNKS come later, so you can wait for a sale.

    1. Buy TIS-100 (or the three-game bundle) on Steam or GOG.
    2. Open the manual PDF that comes with the game. Reading it is part of the game.
  9. Put the path in your calendarAutomatic

    A dated plan only works if you see it. Subscribe once and every week shows up on its own.

    1. On your schedule page, copy the calendar feed URL and subscribe in Google Calendar, Apple Calendar or Outlook.
    2. Or import the path into Things if that is how you run your life.
    3. Block a recurring time slot for study, the same days each week.
  10. Join your cohort and say hi

    People who study with others finish. Say who you are, when you are starting and what you hope to get out of it.

    1. Open GitHub Discussions for cracked.guide.
    2. Post an introduction with your start date.
    3. Find people starting the same week and agree to check in.

Warm-up quiz

Answer in your head, then open the answer. Nothing is recorded.

  1. What does this print? x = 0; for i in 1..4 (inclusive) { x = x + i * i }; print x

    Show answer

    30 (1 + 4 + 9 + 16).

  2. Write a recursive function that returns the n-th Fibonacci number. Why is the naive version slow for n = 50?

    Show answer

    fib(n) = n if n < 2, else fib(n - 1) + fib(n - 2). It is slow because it recomputes the same values exponentially many times; memoize or loop instead.

  3. In Java, what is the difference between an interface and an abstract class, and what does @Override mean?

    Show answer

    An interface declares methods a class promises to implement (a class can implement many); an abstract class can hold state and partial implementations (a class extends only one). @Override marks a method that replaces one from a superclass or interface, and the compiler checks it.

  4. In C, given int a[3] = {1, 2, 3}; int p = a; what is (p + 2), and what does p++ do?

    Show answer

    *(p + 2) is 3. p++ moves p to point at the next int, a[1].

  5. What is wrong with this C function? char *make() { char buf[16]; strcpy(buf, "hi"); return buf; }

    Show answer

    It returns a pointer to a local array that no longer exists once the function returns. Allocate with malloc (and have the caller free it) or have the caller pass in a buffer.

  6. Prove by induction that 1 + 2 + ... + n = n(n + 1)/2.

    Show answer

    Base case n = 1: 1 = 1. Step: assume it holds for n; then 1 + ... + n + (n + 1) = n(n + 1)/2 + (n + 1) = (n + 1)(n + 2)/2, which is the formula for n + 1.

  7. What is log2(1024)? Roughly how many times can you halve 1,000,000 before reaching 1? Is log2(n^2) the same as 2 log2(n)?

    Show answer

    10; about 20 times (2^20 is about a million); yes.

  8. What is 1 + 2 + 4 + ... + 2^k? And what is the sum 1/2 + 1/4 + 1/8 + ... forever?

    Show answer

    2^(k+1) - 1, and 1.

  9. Put these in order of growth: n log n, n^2, log n, 2^n, n. Why is binary search O(log n)?

    Show answer

    log n < n < n log n < n^2 < 2^n. Binary search halves the remaining range each step, so it takes about log2(n) steps.

  10. You changed two files. What commands put those changes on GitHub?

    Show answer

    git add (the files), git commit -m "message", git push. Bonus: git status shows what changed.

On to week 1