What is your favorite exercise?

There are a lot of exercises on Exercism, but which one is your favorite and why?

My personal favorite is run-length-encoding. I love encoding algorithms and I always find myself trying really hard to get a nice and short solution to this exercise. I also find it a lot of fun to solve this exercise in different languages.

Some notable mentions:

  • poker/yacht: usually has me trying to Domain-Driven Design, which is a lot of fun
  • Other encoding algorithms, like rotational-cipher and atbash-ciper
  • Any bit-fiddling exercises, like secret-handshake and allergies
3 Likes

So far my experience is limited to the Concept Exercises, of which I enjoyed Annalyn's Infiltration because of how it taught Boolean expressions.

I also enjoyed Need for Speed because of the way it made me think through the problem at a fundamental level (I also had a brilliant 1-1 teaching/pair-programming session that really helped so am probably biased!)

From some of the Practice Exercises, I am excited to get into Luhn because of the practical implications it has.

3 Likes

My absolute favorite is Parallel Letter Frequency in Go, for many reasons:

  • It suits Go concurrency model perfectly and it’s great at showcasing how Go’s concurrency model can be simple yet powerful.
  • Allows simple solutions to work. If you just started learning concurrency in Go, you can make a perfectly valid simple solution using only a few concurrent constructs.
  • Allows more complex solutions too. When mentoring this exercise, if the students starts with a simple solution, I try to introduce them to more concurrency concepts. This exercise allows practicing those more advanced concepts too, in a way they make sense in the solution and don’t necessarily feel overkill. I’d go as far as saying that you can pretty much learn all the most common concepts around concurrency in Go just with this exercise.

It’s always the exercise I recommend new people when they are learning concurrency in Go. I enjoyed solving it as a student and it’s one of the most satisfying exercises to mentor too.

Notable mentions:

  • Scrabble Score/Isogram - Despite being simple exercises, when learning a new language these exercises are great for having a first contact with maps and string iteration on that language. Allows answering basic, but important questions such as: How do I easily iterate over a string in this language? Does the language have a char type? How do I make a map/set in this language?
  • Ledger - A refactoring exercise in most (all?) languages. Makes you take interesting decisions around refactoring and when mentoring it’s also interesting to see the different approaches people take.
  • Twelve Days - Also a simple exercise around string building on the surface, but can teach you a lot about efficient ways to build a string in that language if you go down the benchmark path. In particular for Go, an efficient solution uses a combination of string builders, string concatenations and string formatting primitives. It’s great to show that no way of building a string is the best performance-wise for all situations and there are benefits in using different methods depending on the situation. Also shows those methods can work together well and there are benefits in doing so.
3 Likes

I love Food Chain because I’ve spent hours discussing it with @kytrinyx and used it as an interview question numerous times, but have never yet seen two people have consensus on what “right” looks like. Which is great because it opens up so many conversations about tradeoffs and patterns, and opens your eyes to lots of different ways of considering code. Bob is another exercises that I’ve had a similar experience with.

I also find Two Fer fascinating, because despite being so simple, 350 of the last 500 solutions submitted at any time are unique - which blows my mind. It was the first exercise I dug deep into with AST analysis too, so it holds a special place in my heart :slightly_smiling_face:

1 Like

Two come to mind:

sieve is fairly straightforward on the surface. The fun comes with thinking through the performance optimizations once the tests pass.

two-bucket is a nice introduction to OOP, and for languages that don’t have OO, how can we get the solution as clean as possible.

1 Like
  • I enjoyed alphametrics for the various bits of optimization which are needed to make it run at a reasonable speed.
  • dominos provides a lot of options for optimizations and code organization which was interesting.
  • forth was fun for the text processing aspects.
  • matching-brackets has an amazing “ah ha!” moment when you figure out what’s needed to solve it cleanly.
  • I enjoyed playing with go routines and channels in robot-simulator in Golang.
1 Like

I’m doing a poll for an upcoming blog post. Is there an exercise that you found particularly fun/challenging/enlightening/evil? :japanese_ogre:

2 Likes

Palindrome Products do I find challenging and fun.

2 Likes

Probably a boring answer but I really like the list-ops exercise. I like that it teaches me to use higher-order functions in a language and it also just brings me joy to implement reduce/fold.

2 Likes

@porkostomus FYI, moved your authored post ("What is your favorite Exercise) under this post because it was the same subject.

Hope that’s all ok!

1 Like

@jonathanmiddleton Great! I suddenly now remember this existed.

For my answer, it was say, which was the last of the “core” exercises on the old v2 Clojure Track.

I noticed that a lot of people cheated, because there is a library with a function that allows it to be solved with a one-liner.

Since I didn’t want to do that… instead I found the source code, gutted it and hacked on it until I could include it as my solution. A sneaky trick that would serve me well for years to come.

My mentor was stunned, because it actually did much more than the exercise called for, outputting English-formatted numbers up to a vigintillion (1063).

It was then that he suggested that I become a mentor, and that’s how I got involved here.

1 Like