Module 04

Arrays & Strings

Bytes vs runes, slicing without footguns, and the in-place mindset.

Practice — write these yourself

Every module ends with exercises. Write each one in the editor on its card and run it right here against the example, then copy the “Check my solution” prompt with your code into a fresh AI chat for a review. Reference solutions are behind a spoiler.

01

Reverse words in a string

Warm-up

Given s with words separated by one or more spaces and possible leading/trailing spaces, return the words in reverse order joined by a single space. " the sky is blue " → "blue is sky the". Do it without a regex.

implement this
func reverseWords(s string) string
main.go · runs in your browser
Tab completes · Ctrl/⌘ + Enter runs
Hints
    Check my solution · paste into a fresh AI chat
    02

    Valid palindrome (alphanumeric only)

    Warm-up

    Return true if s reads the same forwards and backwards, considering only letters and digits and ignoring case. "A man, a plan, a canal: Panama" → true. Assume ASCII input. O(1) extra space.

    implement this
    func isPalindrome(s string) bool
    main.go · runs in your browser
    Tab completes · Ctrl/⌘ + Enter runs
    Hints
      Check my solution · paste into a fresh AI chat
      03

      Rotate array right by k, in place

      Core

      Rotate nums to the right by k steps, modifying it in place with O(1) extra space. k may exceed len(nums). [1,2,3,4,5,6,7], k=3 → [5,6,7,1,2,3,4].

      implement this
      func rotate(nums []int, k int)
      main.go · runs in your browser
      Tab completes · Ctrl/⌘ + Enter runs
      Hints
        Check my solution · paste into a fresh AI chat
        04

        Set matrix zeroes

        Stretch

        If an element in an m×n matrix is 0, set its entire row and column to 0. Do it in place with O(1) extra space (the first row and column can serve as your markers).

        implement this
        func setZeroes(matrix [][]int)
        main.go · runs in your browser
        Tab completes · Ctrl/⌘ + Enter runs
        Hints
          Check my solution · paste into a fresh AI chat
          What the course does between lessons

          The part an AI chat can't give you

          An LLM will happily explain a monotonic stack — and you should let it. What it won't do is decide what you learn next, remember that you got something wrong three weeks ago, or put it back in front of you today. That machinery is the course.

          Review · try it
          card 1 / 5

          Think in half-open ranges [i,j); no …

          Real cards from the two free modules, scheduled by the same SM-2 code the course runs. Every module's key points become cards.

          Today

          Review 12 cards, then continue 14 Backtracking.

          The dashboard picks the one next thing, so you never open the course and wonder what to do.

          Problem → pattern
          • “sorted” + “find a pair”→Two pointers
          • “longest substring…”→Sliding window
          • “next greater element”→Monotonic stack
          • “top k” / “k closest”→Heap
          • “number of ways”→DP over states

          Two full indexes map the phrases you actually see in a problem to the structure or building block they imply. Browse the DSA one free →

          The rest of it

          That's 3 of 81.

          The rest of Data Structures & Algorithms, all of Broader CS, and the full System Design track — including 19 case studies you run as mock interviews — plus every exercise and the spaced-repetition review, are one payment away.

          Already bought it? Unlock