✅ Exercism Swift #15: high-score-board
TIL: inout lets each function update the dictionary in place, and sorted { $0.value > $1.value } turns it into a ranked list.

✅ Exercism Swift #15: high-score-board
TIL: inout lets each function update the dictionary in place, and sorted { $0.value > $1.value } turns it into a ranked list.
Exercism Swift #14: bomb-defuser
Concept: Closures
Closures stored behind a typealias read like data, and makeShuffle returns a closure that captures both flipper and rotator.
Solved expert-mixologist, #13 on the Exercism Swift track.
The hard part: Knowing when a plain loop beats reduce: cutting limes needs an early exit, so for with break is the clearer tool.
✅ Exercism Swift #12: secret-agent
TIL: Returning a closure lets protectSecret capture the secret and the password, so the check lives inside the function it hands back.
Exercism Swift #11: pizza-slices
Concept: Optionals
A switch over a tuple of optionals makes every nil case explicit, and guard let diameter, let slices validates the input in one line.
Solved santas-helper, #10 on the Exercism Swift track.
The hard part: Updating one tuple in an immutable array without a loop: firstIndex, a guard let, then a local var copy.
✅ Exercism Swift #9: bird-watcher
TIL: The exercise teaches loops, but reduce(0, +) and array slicing solved it without a single for.
Exercism Swift #8: chessboard
Concept: Ranges
Ranges aren't just numbers: "A"..."H" is a valid ClosedRange<String>, and contains validates a square in one line.
✅ Exercism Swift #7: magician-in-training
TIL: Parameters are immutable, so var stack = stack makes a local copy to mutate. A guard blocks out-of-range indexes.
✅ Exercism Swift #6: vehicle-purchase
TIL: switch is an expression in modern Swift, and patterns like 2...3 or 4, 6 match license types in one statement.
Exercism Swift #3: freelancer-rates
Concept: Numbers and type conversion
Swift never turns an Int into a Double for you. You convert explicitly, and .rounded(.down) picks the rounding rule.
✅ Exercism Swift #2: Lasagna
Single-expression functions return implicitly, so layers * 2 needs no return. Small functions compose into bigger ones.
#Swift #Exercism #buildinpublic
exercism.org