PearlHelix Learn This week’s puzzle

Aha cards · programming

The traps every coder falls into. Made obvious.

Try it, see it click, keep the rule. A new trap every week, and a puzzle every Monday.

Aha 1 of 3 · Easy

I’m thinking of a number from 1 to 100. Find it in 7 guesses.

1100

Tap the line to guess, or let the middle guess for you.

Why 7 is always enough: each guess at the middle throws away half of what’s left. 100 → 50 → 25 → 12 → 6 → 3 → 1: after six guesses at most one number is left, and the seventh names it. 2⁷ = 128 is more than 100. That’s binary search: one name in a sorted list of a million takes at most 20 guesses.

Aha 2 of 3 · Easy

Drag them into the order a computer sorts text.

  • photo2.jpg
  • photo10.jpg
  • photo9.jpg
  • photo1.jpg

Why: text is compared one character at a time. After “photo”, it’s 1 against 9, and 1 comes first, so photo10 lands before photo9 before the 0 is even read. The rule: sort numbers as numbers, or pad them: photo09, photo10.

Aha 3 of 3 · Easy

A straight 10-meter fence, a post every meter. How many posts?

Why: 10 meters makes 10 gaps, and a post stands at both ends, so posts = gaps + 1 = 11. In code: a loop from 0 to 10 including both ends runs 11 times. Miscount by one and you get the famous off-by-one bug.

Courses · free

A free course, lesson by lesson

Computing Mathematics: discrete math for computer science

A free course on YouTube, with new lessons as the semester runs. Each lesson is short, animated and builds on the last.

  1. GCD, LCM, Euclid’s algorithm and equations
  2. Set theory: Venn diagrams, power sets and Cartesian products
Open the playlist
Play the courseOn YouTube · free

One puzzle, three days

  1. Monday · the problem. A short story with a real algorithm inside it, and sample data to try.
  2. Wednesday · the hints. The one idea that unlocks it, without giving the answer away.
  3. Friday · the walkthrough. The reasoning step by step, why it is correct, and tested code in C++ and Python.

Every puzzle is original or credited, and checked against a brute-force solution before it is posted. Follow along on PearlHelix Learn on Facebook; a Puzzle Club for sharing solutions is on its way.

Questions

Is it free?

Yes. The weekly puzzle, the hints, the walkthroughs, the daily reels and the course are free to watch, read and share. The live class is a service we set up for schools and universities.

Who is it for?

School and university students, and anyone who likes to think before they code. The puzzles start gentle and grow with each week.

Will you solve my homework or contest problems?

No. The puzzles build your own skill. We don't complete graded coursework, take-home tests or live contest problems for anyone.

For teachers and institutions

A live class where every student answers

Teach from your screen and voice. Students join from their phones, answer timed questions, and tap “lost” or “slower” when they need you. We set it up for your course.