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

The Fellowship of the Code

Start date: June 5, 2021, 5 p.m. UTC
Given a string and an integer K, return the lexicographically minimum string that can be achieved by applying at most K swaps of adjacent letters.

One Code to Rule Them All!

The first three brave dwellers of Middle-earth to solve the challenge perfectly in the least amount of time will be added to the Codility Hall of Fame, winning a package of swag and of course, bragging rights. The first place winner will also claim a precious copy of Fluent Python by Luciano Ramalho; may it be a guide to you in dark places, when all other guidance goes out.

Once The Fellowship of the Code Challenge has ended (on June 19th), you will still be able to take the challenge, and gain certificates, but will no longer be in the running for prizes.

Good luck in your coding adventure!

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


2490 started 309 silver awards 42 golden awards

Hall of fame:

乐平 汪
Time: 10 minutes
Peng Cao
Time: 15 minutes
Xuan Bach Tran
Time: 25 minutes