Each day I solve several challenges and puzzles from Codr's ranked mode. The goal is to reach genius rank, along the way I explain how I solve them. You do not need any programming background to get started, but you will learn a ton of new and interesting things as you go.
In this challenge we have to fix two bugs (🐼 and 💧). The first line of code creates an array of numbers, where 💧 is an unknown, probably a number as well. Then lower down we have a for-loop which goes over each number in the array. It then compares each number with R
. If the number is greater than R
, then R
becomes 🐼. In a nutshell, this simple algorithm keeps track of the largest value in the array, and 🐼 is most likely going to be el
.
If you read the last comment, the challenge states that R should be 9
. If we look back at our array, we see that number 9 is already present, so it doesn't matter what 💧's value should be.
If you feel inspired and motivated to upgrade your coding + debugging skills, join me on the Road to Genius at https://nevolin.be/codr/
Top comments (0)