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 post I will cover two challenges, because the first one is pretty short ;)
In the first challenge, we are given an array which we fill with numbers using a for-loop. At the end we compute the value for R
by checking if 💰 includes the number 6. The task is to find what identifier 💰 is. But as I already spoiled, it's the array which we filled up. There, done!
The second challenge is only slightly more complicated than the first one. There's a bit more code, but still peanuts to solve. The quest is to fix two bugs (💚 and 🐼), such that R = 30
. The first several lines of code create an array people
which consists of 4 objects. If you look at the members of these objects they are name
and age
, looks like the object is representing a person. Then we see there's a for-loop which iterates over all objects in the array, this line contains a first bug 💚, we can safely assume that 💚 should be the variable person
because it is used below. Next, the if-condition checks if the person's name equals ana
, if that is true, R
gets the value of that person's age. If we look back at our array of people, the person named ana
has age 30, as expected.
But hey, what about 🐼? In this scenario it's irrelevant what 🐼 should be, just make sure it's not ana
to ensure that R=30
is true.
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)