DEV Community

bellsofaba
bellsofaba

Posted on • Updated on

Excavating Your Inner Problem-Solver: Embracing Coding Challenges

How To Excel at Coding Challenges as a Beginner

Coding challenges. Whew! They are the bane of most beginner software developers. Considering the difficulty, anxiety, and, to some extent, time constraints that coding challenges are known for, this is not further from the truth. While it remains burdensome to most developers, it is a love-hate relationship for others.

Depending on what side of the fence you belong to, it doesn’t change the fact that they are an essential component of what constitutes a well-rounded developer. If you are looking for a software developer job these days, odds are you already know how crucial it is that you become a well-rounded developer.

Becoming a well-rounded developer is my hope for you. It is a feat reserved for people who dare to be different. It offers a difference between the bounty veteran developers gain at the top and the scraps at the bottom.

Howdy coder! Brace yourself. Let’s journey to the top for the stamp of achievement. By embarking on this quest, you will create an awareness that will give you the boldness to traverse all the enchanting mysteries that shroud coding challenges. On this magical journey, you will unravel how algorithms beat it to a choreographed dance and how data structures churn out whispered secrets to offer you rewards.

The rewards…

The rewards are plenty, sandwiched in valleys of processes that serve as maps to various destinations—treasure troves hidden as solutions, waiting to be unraveled.

Little Pirate In Booty

The Realm of Hopelessness

Admittedly, if you have recently ventured on your pilgrimage to coding challenges, they will, to a large extent, seem like behemoths—unscalable and intimidating. Another trait of theirs is the elusive and proud aura they exhibit. They intend to make fun of your cluelessness and desperately want to remain mischievous while leaving you bewildered. Huh!?

Cute Doggo

Luckily, you can shake off the feeling of hopelessness. The first thing you want to do is stay calm.

Michael Scott From the Office Panicking

Don’t resort to head-scratching and give in to the resolve of cluelessness. Being clueless when starting is normal and a part of the learning process. Celebrate a bit. There’s joy in shared misery. Yey! This misery is not exclusive to you, so you will do yourself a favor by not latching onto it. Do your time and get out. Get out so that you can help others. This moment is your toe-dipping phase. Or your learning foundation. And like all learning, two options lay bare for your consideration.

Your Options

The first choice is acceptance. You irrevocably accept what is to come. You embody a willingness to immerse yourself in a series of perplexing puzzles. I’m not going to lie to you. It will hurt. It will particularly hurt the brain. It is supposed to hurt. Compare this pain with the heart palpitations and muscle soreness you experience during exercise.

Admittedly, you and I know why the brain hurts and will hurt at this stage. No? Just me? Maybe you do. Well, it doesn’t hurt to reiterate, does it? When you are new to coding challenges, your brain will feel strange due to its lack of use in problems that lean towards complexity. It will remain that way for a while unless the genius in you is Einstein-level, which makes you the exception. The light at the end of the tunnel is that after the hurt comes clarity. Yes. It gets better.

It is either that or the second choice, nothingness—a void. It has one role, and that is to downplay and question what the aim of putting your brain through unimaginable confusion is. The former knows why a little discomfort is necessary for your interests—to unlock growth. The latter just wants to chill and confine your attempts at growing.

Chilling (or resting) is phenomenal. It is a condiment for growth. But overchill is overkill. To overcome this hurdle, you’d have to downplay chilling and put it on pause. Coding hours are synonymous with deep work. These hours are for focus. So, consider this your invitation to embrace sturdiness with your hand on your wand (cough, keyboards).

This invitation will herald a path that necessitates a headfirst dive in. Why? Because it is a captivating realm. There are no limits to the possibilities. You are allowed to employ all your artillery to arrive at a solution. In that regard, using both conventional and unconventional methods is equally important so that you can unravel your prowess at problem-solving.

Remember that you need to be focused and avoid distractions for the best results, which will come as a complete surprise to you in the early days. During the coming days, weeks, or even months that will follow, you will gain more clarity on the mechanisms of coding challenges.

That is how you unravel what is going on. We'll examine the strategies required for you to master coding challenges. In the meantime, why do you even need to bother to learn about coding challenges in the first place? You might have a myriad of valid reasons.

Why Coding Challenges Are Important

It is no secret that you will encounter so many challenges when you start having a go at coding. But despite the hurdles you will likely experience, there are many reasons why coding challenges are vital for you. A continuous trajectory of learning through coding challenges will provide you with a plethora of knowledge.

Problem-Solving Skills

Meeseeks from Rick and Morty

Problem-solving skills can be honed and nurtured when solving or attempting to solve coding challenges. Critical thinking is a requirement for breaking down questions into chunks. To arrive at a solution, you should know how to articulate what the question asks of you.

By regularly solving coding challenges, you will witness an exponential upsurge in your understanding of questions that fall into the same category. If you don’t expose yourself to such problems daily, it becomes increasingly difficult to determine how to solve the challenges. Your consistency will get you closer to becoming a master at the craft.

Algorithmic Thinking

Cute Little Girl Performing Mental Calculations
When you practice coding challenges daily, one of the incentives you gain is the ability to think algorithmically, logically, and systematically. Algorithmic thinking helps you develop the ability to think in terms of algorithms, which invariably helps with your understanding of the best way to approach various methods of data structures. That is how you can successfully pass coding challenges.

Development of Technical Skills

Tony Stark Working
Coding challenges are multifaceted in terms of what encompasses their makeup. There are different programming languages, frameworks, and concepts. The best approach to tackling them is to pinpoint an area that exalts your strengths and hammer them down until you can wield and shape them. You have to keep having a go at it until it becomes second nature. That is how technical skills become ingrained in your subconscious.

Interview Preparation

Looney Toons
Coding tasks during job interviews will initially seem daunting. Your best bet at mitigating this is to come prepared. Let me introduce you to the “7 Ps of Success” principle.

Proper
Planning and
Preparation
Prevent
Piss
Poor
Performance.

The 7 Ps of Success emphasize the need to prepare for something you will inevitably face. This principle will ensure you are not hurled into a whirlwind of confusion and embarrassment when you need to face it. To adequately prepare for something, it all boils down to time allocation and preparation. It’s like not brushing or flossing your teeth and then dreading a visit to the dentist. A careful examination of the scenario will make you realize the disconnect. Get acquainted with the dentist as soon as possible so your teeth don’t fall out, or wait it out — an unpleasant scenario that will not be viable or pleasant for anyone in the long run.

A better thing to do is to deal with the unpleasantries from the get-go. Make it a part of your curriculum to practice coding challenges daily. That is the only way to boost your technical skills and confidence in interviews. But if you are a snake oil salesman and can talk your way out of a coding interview, all the best.

Lifelong Learning

Kungfu Panda
When you can reach the pinnacle of making coding challenges your own and not the other way around, rewards await you. There is a zenith of growth that becomes a part of your life. This growth becomes evident in the company you will keep (a league of extraordinary geeks), the remuneration packages you will attract, the curiosity your mind wanders for, the motivation that will become a part of your new makeup, and much more. These are equally important, and it’s up to you to use your discernment to prioritize what matters most to you.

How to Understand Coding Challenges

Understanding coding challenges is another area that needs further elaboration. When you decide to solve coding challenges daily, you will find your consistency at odds with what is going on. What is behind a coding problem? What does it say? What does it want from you? To understand all these, a couple of things emanate to shine a light on the task.

Foundations Mastery

Fast Crawling Baby
Without adequate knowledge of a programming language, it will be best for you to bookmark this post or add it to your reading list in the hopes that you will revisit it later. That’s because until you have done the needful —learn your fundamentals—you will not be able to grasp the concept of coding challenges.

However, I’d be remiss if I hastily chased you away after dedicating your time to reading this post. Instead, be happy to learn that there are quite a few coding challenges specifically curated to help beginners with foundational knowledge. You can refine your search on any coding challenge website by using the keywords: “foundation”, “tutorial”, or “beginner.”

When it comes to crafting mastery, tools are an indispensable part of your kit. The same is true for coding challenges. Programming fundamentals are the tools that are necessary for getting over any kind of coding challenge. When you step into the fantastic world of coding, your foundational knowledge has to be top-notch.

You must know the prerequisites that beginners need to know. To do so, you must first become acquainted with the mysticism of variables, loops, conditionals, functions, all data types, and the artful manipulation of data structures.

A firm mastery of the above concept will give you a general overview and be your compass.

Where to Find Free Code Learning Resources

You can learn coding fundamentals from websites that offer free lessons. Some websites with free resources are listed below.
FreeCodeCamp,

The Odin Project

And if you are looking for a free boot camp where you will find a vibrant community of supportive developers, (that's right, it's absolutely free), check out a 100Devs. With a 100Devs, you go through 30 Weeks of learning to become proficient at Full-Stack Web Development at no cost.

Additionally, you can check out a couple of other paid resources that offer extra uniqueness.

Programming Expert,

Scrimba

Lastly, you can check out Code-Squid, a beloved project by a friend of mine with close to 4 decades of coding experience, Bob.

Important: Please note that the listed websites are all recommended for recommendation purposes only and are not affiliate links. You can explore more of their offerings if you are feeling generous. There's no harm in appreciating fellow developers who might become instrumental in your learning journey.

Compartmentalizing the problem

Rubix Cube Breaking Apart

Problem-solving requires determination and wit. In that regard, it is not in your best interest to hastily approach the problem. Remember, these are uncharted territories. The problem statement would involve acknowledging its tapestry. You will need to know what its components are. Is it a labyrinth, or is it pretending to be one? Pause and consider all the possibilities and constraints.

Afterward, you will enter a mental state that carefully flips the problem on its head to dissect it. It is your operating table. And you are the surgeon. You will need to go Sherlock Holmes on it without any reservations. You have to let it know you are a master at solving puzzles.

When you reduce the problem into chunks and pieces, you will realize that each piece holds a clue to the larger mystery. Properly weighing the inputs and the expected outputs will help you see that it is not the behemoth it purports to be.

To further elaborate on how to break down the question into chunks, I have selected a beginner friendly 8 kyu level kata from Codewars. This kata sheds light on how to break down a problem using the PREP method. PREP is an acronym for Parameters, Results, Examples, and Pseudocode.

Question: Sum of positive
Description: (Reworded for clarity)
Imagine you have an array of numbers. You are required to return the sum of all of the positive ones.

Example [1,-4,7,12] => 1 + 7 + 12 = 20

Note: If there are no positive numbers to sum, the default should be 0.

Solution

function positiveSum(arr) {

}
Enter fullscreen mode Exit fullscreen mode

Compartmentalizing the problem and determining the solution

As previously mentioned, the PREP approach to solving coding challenges is what we will use to solve this problem.

The first thing we will tackle is parameters.

Parameters
This coding challenge has one parameter for us: arr. It is contained in the brackets ( ) after our function name, positiveSum. In this case, the function takes an array (arr) as its parameter. Even though the arr does not explicitly have numbers stored, it is assumed to contain a list of numbers similar to those provided in the example.

Results
The result is the intended outcome we hope to achieve from this coding problem. The result is what the function will return at the end of the coding challenge. The function must return the sum of all positive numbers in our array. Our example illustrates the predicted outcome. Also, remember that the result will be 0 if no positive values exist in the array.

Examples
Our example is straightforward. It offers insight into the expected output when there are a set of inputs. In our example array;

arr = [1, -4, 7, 12]
Enter fullscreen mode Exit fullscreen mode

You’d notice three positive numbers, 1, 7, and 12, out of the four integers in the array. After going through the array, we would pick out the positive numbers and ignore the negative number, -4. Afterward, we will add up the numbers:

1 + 7 + 12 = 20 //Sum of positive numbers. 
Enter fullscreen mode Exit fullscreen mode

Carefully analyzing examples is an effective way to get a hint of the desired outcome. When you can weigh the inputs and determine their output, the pattern to arrive at the answer becomes clear. Following this pattern will show you the intriguing mechanisms of how the coding challenge works.

Pseudocode
Our pseudocode is a working process or a layman's explanation of the processes involved. It tells us how to answer the question without literally writing the code. For our example, we will break it down into the following:

Initialize a variable and call it aggregate

let aggregate = 0
Enter fullscreen mode Exit fullscreen mode

Because this is where we will store our positive numbers. We need this because computers cannot mentally keep invisible numbers as we do in our heads. The initialized variable will be 0.

Now you might be asking why have we initialized it to 0? We’ve done this for two main reasons:

The first is that our outcome should be an integer. Secondly, 0 is a good starting point when we need to add positive elements(numbers) after going through the array. When we check our array and stumble across positive numbers, we add them to 0.

After initializing our variable and setting it to 0, we will need to check the entirety of our array to look for positive numbers. What helps us achieve this is a loop. Loops help us navigate the elements in an array. For our example, we will use a for loop. It will enable us to loop through the entire length of the array and check each element therein. A for loop has three sections. The first section is the initialization stage, the second is the condition stage, and the third part is the final statement.

Next, our for loop will enable us to confirm if a number or an element in the array, (denoted by arr[i]) is greater than 0.

If it is > greater than ** > 0*, we will **add it to our initialized variable* which we have named aggregate. The + operator will help us achieve this.

After iterating through all the elements in the array, we will combine all the positive elements we find in the aggregate variable.

Finally, we return the calculated aggregate of all the positive numbers.

After everything is said and done, when these powers combine, we will form Captain... Oops, our function will look like it does below.

Solution

function positiveSum(arr) {
  let aggregate = 0;  // Initialize a variable called aggregate that will store the positive numbers in the array. This has been set to 0.

  for (let i = 0; i < arr.length; i++) {  // Our for loop goes through each element in the array.
    if (arr[i] > 0) {  // We use an if statement to check if the current element is greater than 0.  (positive).
      aggregate += arr[i];  // If the element is positive, add it to the aggregate sum.
    }
  }

  return aggregate;  // Return the final sum of positive numbers.
}
Enter fullscreen mode Exit fullscreen mode

Here is another summary of our code and what we did to arrive at a solution.

let aggregate = 0;

We initialized a variable called aggregate. This helped in storing our positive integers. To start on a clean slate, we set it to 0.

for (let i = 0; i < arr.length; i++) {

This is a loop that iterated over the elements of the array. It started with i as 0 and continued until i reached the length of the array.

if (arr[i] > 0) {

Inside the loop, we checked if the current element at index i was greater than 0. If it was, it meant the number was positive.

aggregate += arr[i];

The current number in the array returned a positive number, so, we added it to the aggregate sum by using the shorthand += operator. This accumulated the positive numbers.

return aggregate;

Finally, after iterating through the entire array, we returned the aggregate sum as the result of the function.

Studying and Researching

Doggo Studying
If you don’t study, you will not familiarize yourself with crucial concepts. The only way to know what is out there is by looking. Algorithms are known to be tricky, but they will appear even more so if you haven’t the slightest idea of what you are looking at. Therefore, I urge you to embrace studying things that are important but seem mundane and let them become a part of you. Or, you could utilize more effective tools like Anki to make studying worthwhile.

If you are familiar with the concepts of learning, you know that if it hurts, it only means you are experiencing growth in some way. If your learning starts becoming a little too comfortable, you know you have reached a plateau. You will need to push the boundaries to utilize more brain power. Consider exercise. When you are no longer experiencing any changes, you know it’s time to switch up your routine with something different.

Constantly iterating your study pattern and refining your approach by immersing yourself in blog posts, video tutorials, documentation, textbooks, and more is how you expand your knowledge base.

Solving Incrementally

Bird Building

Let’s get back to the exercise analogy. I bet you can already tell I am a fitness person. There is a clever strategy for lifting heavy weights. Or for incorporating exercise into your workouts. It involves patience, time commitment, adequate nutrition, and more. But the most fundamental is what I have listed.

As a gym newbie, even when you unintentionally skip the gym for too long, if a bit of an ego boost makes you rush to the heavy-weight section where you use too much of your energy to pick weights your body is not ready for, you will find out the hard way why that was a horrible idea. The next couple of days will be awful for you.

You will experience what is known as delayed-onset muscle soreness, or DOMS. And if you choose to start with weights ideal for beginners, latching onto them for too long will cause your growth to plateau.

Now, with coding, you should employ the same tactics to maneuver your way to the top. Abiding by this strategy will help you conquer even the most formidable coding challenges. Start with simple problems and then ascend to harder ones.

Incrementally approaching coding problems is how you can make the biggest of them crumble before you. That is how to expand your intellect and solve different levels from several vantage points.

Reviewing Solutions Submitted By Others

Jim Carey Peeping
When you solve a coding challenge, your solution is considered part of your repertoire. It is a win for you. But to understand the other ways you could have approached the challenge, you should look at the solutions submitted by others. Don't worry, it's not cheating. Looking at what other developers submitted will help you uncover a myriad of possible approaches. These approaches will help you broaden your horizons and explore new paths. Tapping into the perspective and logic of others is a limitless way to improve your versatility.

Communal Convergence

Friends
As humans, we have been able to build cities and send rockets into space. The reason we have been able to achieve these feats isn’t attributable to our strengths. It is not because of our self-imposed position at the top of the food chain, either. It is due to our camaraderie and the ability to work collectively. Working together is how we can apply our wisdom to different specialties.

On your coding odyssey, surround yourself with a diverse community of like-minded individuals. There are several programming communities, seminars, standups, study groups, and more that you can join. These will expose you to interactions and insights that will clarify any hurdles.

Reflection and Iteration

Refactoring
To get better, you should harness your strength to reflect. Reflecting on the steps you used to arrive at the solution is one way to enhance your knowledge of the subject matter. With adequate reflection comes growth and improvement in areas you once thought unfathomable. Remember, your brain needs time to recuperate.

Introspection will assist you in identifying easy areas and those that weren't—areas that put up a fight. With this, you adjust your strategy and concentrate on subjects that make you feel short. There is no harm in refining your study methods according to your strengths and weaknesses. Remember, our weaknesses are part of what makes us human. We all have them.

Persistence

You are no quiter
Without persistence, we are nothing. A valuable lesson can be learned from babies. They go from crawling to walking, and then running. We were all babies in the past. You can absolutely persevere.

Make patience and persistence your hallmarks of strength. Don’t let them go. Engrave them in the depths of your subconscious as a constant reminder that you need to get better. Understand that the path to unraveling coding challenges is not a sprint but a marathon that requires time and effort. Embrace the virtue of patience, for Rome wasn't coded in a day.

You automatically accept the challenges that come your way with unwavering resolve when you are persistent and do not waver in your pursuit of mastery. There will always be challenges along the way, but if you don't give up, it becomes a favor for yourself. Consider obstacles as catalysts that pique your curiosity rather than running away. Keep going despite the uncertainty and darkness by remembering that there is light at the end of the tunnel. You'll escape unscathed if you do that.

Conclusion

Waving bye
Make coding essential to your daily routine, like eating food. Through regular exposure and active learning, you will witness the gradual blossoming of your problem-solving skills. Each challenge conquered and each line of code written will deepen your understanding and illuminate the intricate workings of coding challenges.

So, my tenacious companion, embrace the journey ahead with patience, persistence, and unwavering consistency. With these virtues as your allies, the realms of coding challenges will unveil their secrets, and you will emerge as a master of the craft that traverses all the known paradigms.

Strive for what is feasible. Remember, you don’t have to be perfect. The best you can do is keep pushing the envelope and asking for help that you can use. If you keep doing that, sooner or later, you will move toward something that magnifies your coding prowess.

Spock
Go forth and prosper!

Top comments (0)