Your browser (Unknown 0) is no longer supported. Some parts of the website may not work correctly. Please update your browser.

Code Alone

Start date: Dec. 18, 2021, 5 p.m. UTC
Calculate the minimum required number of swaps of neighbouring letters in a string built from the letters 'a' and 'b', after which the string would contain both "aaa" and "bbb" as substrings.

All I Want for Christmas Is Code!

Even though you should complete this challenge solo, you are definitely not alone this holiday season! Join thousands of people honing their coding skills with Codility Developer Training.

The first 3 developers to solve the challenge perfectly in the least amount of time from the start of the challenge will be added to the Codility Hall of Fame and win a $25 Amazon Gift Card. Feel free to spend it on the gifts for yourself and your loved ones.

Once the Code Alone challenge has ended (on January 1st), you will still be able to take the challenge and gain certificates, but you will no longer be in the running for prizes.

We wish you a joyous holiday season and Happy New Year, and of course, good luck with the challenge!

About Codility

We help engineering leaders hire great software developers into their teams by evaluating technical skills in an unbiased way. We’re committed to levelling the playing field by building a platform that provides equal opportunity to all developers worldwide. Interested in joining us? We’re currently hiring engineers to work remotely from all over Europe.

The challenge is now over, but you may still practice on this task. Below, you can also find a video with explanation of possible solutions for the task:

View careers


2337 started 43 silver awards 46 golden awards

Hall of fame:

Daniel Górski
Time: 49 minutes
Yury Pisarchyk
Time: 1 hour, 10 minutes
Benjamin Meeker
Time: 1 hour, 44 minutes