How the heck do I use Anki to remember my Codewars solutions?
Eric Carlson
Posted on November 27, 2023
Maybe you’ve been grinding Codewars to work on some fundamental coding skills. Maybe you’ve even progressed into the more advanced questions on Codewars or started doing some LeetCode too. But there’s a problem!
When you go back and look at some of the more basic Codewars challenges, you can’t remember anything about them! Ack!! Codewars has marked them as completed, so you did really solve them, but in the months that have passed, these problems have faded entirely from your memory!!!
I don’t know about you, but I find this situation alarming. What is the point of doing all of these coding exercises if I’m going to forget everything after a few months?
- Note - if you are new to Codewars, check out this excellent guide to getting started.
Anki to the rescue
Luckily, there is a simple solution to this memory problem by using a technique called "spaced repetition." Even better, there is a free app that you can use to do spaced repetition called Anki.
Let’s say you have just solved the Reversed Strings challenge using the solution below. (Yes, there are many other ways to reverse a string, but let’s stick to the basics for now.) The question now is how to use Anki so that you never forget this solution.
Adding a Codewars challenge to a flashcard
Just like there are many ways to reverse a string, there are many ways to use the flashcards that you get with Anki. I will show you the way that works best for me, but of course, feel free to experiment with the options that Anki provides.
If you’re new to Anki, there are lots of tutorials to get you started overall. I will focus on the specifics of adding a Codewars solution here.
I like to use the “Basic (type in the answer)” option for my Codewars cards. It works just like the Basic one, but you have the option of typing in the answer, which I find keeps me honest.
Now I go back to the Codewars window and copy the name, the description, and the examples for the challenge.
Paste these items into the “Front” section of the flashcard.
Now go to the Solutions tab in Codewars and copy the full text of the function you want to remember - along with the function name, the curly braces, the return statement, and everything else.
Go back to Anki and paste the function ALSO IN THE FRONT SECTION!! Yes, the Front!! Why, you ask? Read on!
Curating the back of the card
The reason to start on the front of the card is that we want to curate the back of the flashcard very carefully. It may look like a simple step, but selecting what to put on the back of the card is a crucial decision.
As the solutions get a bit longer, the choice of what to put on the back gets even more important. If you put too much on the back, you can slow down your entire daily Anki sessions (and maybe abandon your Codewars cards as a result - horror!). If you put too little on the back, you may not memorize the essential logic of the solution.
How do you pick what goes on the back?
I find that there is no general rule for how many characters or methods to place on the back of my cards, but overall, shorter is better.
If I was learning this function for the first time, there would be two main options for what to put on the back of the card.
Option #1 - Short and sweet
If I was comfortable using split() and join(), and the reverse() method was the thing that I was learning, I would do it like this.
- NOTE - There are some fancier ways to handle the "code here" part of it, but I like to keep it super simple.
Option #2 - All three methods on the back
If the whole string of methods was new to me, I would put all of them on the back like this.
The selection is more of an art than a science - it’s about finding what piece of the solution I need to remember better so that I can recall the entire solution better. My understanding and memory of a solution may evolve over time, and if it does, I edit what goes on the back of the card to correspond.
Conclusion
That’s it! The process looks deceptively simple when you look at it like this. It might even seem too simple as you start adding solutions like this one for reversing a string.
But wait until you start adding a new solution every day (or so) and then start drilling these solutions every day (or so). Do this for a month or two, and I think you'll find that this practice starts to expand your memory/knowledge in a surprising and even mind-bending way.
Imagine how much you will memorize in the next year if you do a new Codewars challenge every day and use Anki to remember every one of them!
Posted on November 27, 2023
Join Our Newsletter. No Spam, Only the good stuff.
Sign up to receive the latest update from our blog.
Related
November 30, 2024
November 30, 2024