Each challenge each week is drawn from real-world developer job interviews, as reported by interviewees on resources like LinkedIn and Glassdoor. In an interview setting, these brain teasers can be stressful but in a low-pressure environment they can be fun! If you practice a few of these questions and see other results, hopefully you’ll be able to have fun with these sorts of questions in interviews too. Even if you’re not applying for jobs, these challenges can be very useful – if you’ve finished a Codecademy course, these exercises can help you stay sharp or push yourself to the next level.
- 00: The Classic FizzBuzz Challenge
- 01: Sum of Prime Factors – Winners: @javawhiz18379 and @rublen
- 02: Unique Characters in a String – Winner: @marek4
- 03: Anagram Detector – Winners: @tomegz and @cloudrunner15916
- 04: Reverse Words – Winners: 1st place @gigawhiz30076, 2nd @brotherpeteniemeyerg, 3rd @javiervfa
- 05: Binary Search Tree – Winner: @tagrockstar79958
- 06: Word Transformation – Winner: @ricebill
- 07: Number Permutation – Winner: @lmreia
- 08: Maximize Stock Trading Profit – Winner: @arthgw
- 09: Prime Number Printer – Winner: @b-twin
- 10: Max Product Finder – Winner: @tomodachiii
- 11: Fibonacci Finder – Winners: @betamaster97156 and @chrinkus
- 12: Palindrome Detector – Winners: @betamaster97156 and @tagrockstar79958
- 13: Top Score Sorter – Winner: @shrinkhla
- 14: Select a number, any number – Winner: @naryaclue
- 15: Product of Everything Else – Winner: @senyoret
- 16: Change Please – Winners: @cmecklenborg, @boglee28 and @chipcoder14919
- 17: Egg Dropper – Winners: @boardwhiz21711 and @sirrobsmith
- 18: Comparative Weights – Winners: @webcoder40641 and @cloudrunner15916
- 19: Stairmaster – Winner: @sirrobsmith
- 20: Calculate Max, Min, and Averages
- 21: Flatten an Array
- 22: Find the Missing Number
- 23: Print Times Tables
- 24: Semi Prime Numbers - written by @star3lord
- 25: [Extreme] Tolerant String Matching
*26 [Challenge] Secret Santa
The Basic Challenges
If you find this level of challenge easy, that’s actually not unusual in interview situations, but interviewers often ask you to not only thoroughly explain your process but to up your game in an extension to the initial challenge, so you should definitely try to build on your basic implementations and turn them into solutions for the intermediate and hard challenges!
Basic challenges are good practice for programming languages you have just started learning, so if you are a Python expert but have only just started Java, try the hard challenge in Python and the basic challenge in Java. There is no limit on the number of submissions in different programming languages you can make!
For a fun challenge try to directly convert your code from one language to another (e.g. Python code into Java), it will give you a good idea of the fundamental differences between two programming languages of your choice.
The Intermediate Challenges
Sometimes there can be a big leap in difficulty between the basic challenge and the intermediate challenge. Interviewers will often ask a follow-up question or two so that the interviewee will be pushed further, needing to refine, improve upon, or completely reshape their initial solution. Given that the challenges lead on from each other in this way, if you are stuck on the intermediate challenge try to go back and perfect the basic version before attempting the intermediate version again.
If you get stuck try looking at other peoples submissions to give you an idea of how it’s done, and then create your own version (don’t forget to tag (@) the people who helped you reach your solution, they will appreciate knowing that they’ve helped!).
The Hard Challenges
If you are struggling with these, that is the point! Most people should be able to do the intermediate challenges if they push themselves, but the hard challenges are just impossible if you do not have the right knowledge. This doesn’t mean you should just give up though! If you don’t understand a concept, just Google it, look around on sites such as Stack Overflow and learn what you need to do. In a job or university degree, you will not be given everything you need to do, make yourself a mission to find it yourself, it will be a rewarding experience.
Big OMost of the hard challenges include Big O notation. You can learn more about Big O and time complexity [here](https://rob-bell.net/2009/06/a-beginners-guide-to-big-o-notation/) and [here](http://stackoverflow.com/questions/487258/what-is-a-plain-english-explanation-of-big-o-notation). There's also an old (and thus unsupported) [Codecademy course on Big O](https://www.codecademy.com/courses/big-o/0/1) if you prefer.
How To Participate
Submissions in C++, C, or other languages not taught on Codecademy are welcomed, but these may not be eligible to “win” as a featured submission (see below)
Please include a link to your code running on repl.it, the quantity of submissions means that code just copy and pasted in or given through another site can and will not be looked at. The easiest way for @moderateurs to see your submission is by using repl.it, so if you want a chance to win make sure you use it!
As cool as it is to get a preview of your code, when we have a lot of submissions it makes the whole thread take longer to load and read, so please just provide the link and not the preview box.
Please also post your code directly, making sure that it is correctly formatted with backticks (
`), the key above
tabon most keyboards. Wrap snippets of code in one backtick e.g.
console.log(), and wrap in three backticks (e.g.
```block of code ```) for a block of code.
The best submission or submissions will be featured here on the forums and via various social media channels (like our Twitter)
Solutions submitted before 6:00 pm in New York City on the Tuesday immediately following the code challenge are eligible for consideration as a featured “best entry.”
To be considered as a “best submission,” you must explain your thought processes in making your answer: how and why you designed your function the way you did. This way, we’ll be more certain that you came up with your own solution, but crucially this is part of the reason why this type of question is asked in job interviews.
Given the volume of contributions each week, entries that do not follow these rules and the challenge instructions themselves precisely cannot be considered as a best entry. For example, if the challenge asks you to return a specific set of integers as a solution or give your function a particular name, you must do that!
We will prefer solutions that do not use imports to do the heavy lifting, even though this would make for a nice short approach each time. We prefer solutions without imports because in an interview you would be expected to talk through your solution, and an answer of “get combinations using itertools” wouldn’t impress many, nor would it show your thought processes in tackling a difficult challenge as opposed to your knowledge of tools!
Remember, the point of code challenges like these is to test and stretch yourself with an unusual problem, so don’t be dissuaded if you find it difficult or don’t know where to start! Start with Googling, but see if you can find out how to think about the problem and what tools you need to solve it, but don’t just go looking for the solution itself. This way, it’ll be a better learning exercise for you - developers can’t always find and copy “the right answer” online, which is why questions like these are used in developer job interviews! Interviewers want to be able to see how you think through problems and not just whether or not you can solve them.
In a similar vein, solutions using imports to do all the heavy lifting such as
itertoolswill not be considered for the winner - using these imports doesn’t test your problem solving skills in the same way, and won’t impress an interviewer.
If you are interested in “winning” the code challenge, please don’t use any unusual repos or anything that will make it difficult for us or your fellow users to assess your answer quickly.
Do you have a code challenge to share with other users? Issue it! Make a new topic with
[Challenge]in the title to open a challenge, maybe we’ll even feature it in our next newsletter!