The 5 hardest code challenges for beginners

The 5 hardest code challenges for beginners

Image for post

On Coderbyte we offer over 70 ?easy? difficulty code challenges that are perfect for beginners who are learning to code and need some way to practice. We looked at the stats for our easy challenges (excluding the medium and hard questions) and found the ones where users struggled with the most to achieve a perfect score. We ended up narrowing down all the easy challenges to find the 5 hardest ones listed in the ?easy? section ? where by easy we mean challenges that should be solvable somewhere between 15?25 minutes by a beginner coder.

Hardest Beginner Challenges

The 5 hardest ?easy? challenges are listed below:

  • Question Marks: Requires looping through a string and checking if certain conditions are met.
  • Vowel Square: Requires finding a 2×2 square of vowels in a larger matrix.
  • Scale Balancing: Requires looping through an array of weights to determine if a scale can be perfectly balanced.
  • Correct Path: Requires traversing through a partially finished path in an NxN matrix and finishing the path.
  • Closest Enemy II: Requires checking the distance between certain points in a NxM matrix.

Out of these, the challenge where users struggled most to get a perfect score and spent the longest time solving is Question Marks.

Challenge Description

Take an input string parameter and determine if exactly 3 question marks exist between every pair of numbers that add up to 10. If so, return true, otherwise return false. Some examples test cases are below:

Before reading further, try and think of how you would solve this challenge (you can even write down some steps in pseudocode, or better yet you can write a solution on Coderbyte).

Analysis

This challenge requires several layers of logic to get right, which is why it can be difficult to come up with a solution at first. It requires looping through the string and maintaining the position of every pair of numbers that add up to 10. If you do find two numbers that add up to 10, then you will need to determine if exactly 3 specific characters exist somewhere between these two indices.

  • 68% of users who submitted a solution in JavaScript didn?t get a perfect score.
  • 35% of users who submitted a solution in Ruby didn?t get a perfect score.
  • The average number of lines for a solution is 15?29.

Sample Solutions

Below is a very concise and elegant solution written in Python by the #3 ranked user on Coderbyte, Qlogin.

There is also a clever regex solution that a user on Coderbyte implemented in Java to solve the challenge:

Try out the challenges for yourself on Coderbyte and comment below on what you think about the sample solutions!

18