DEV Community

Cover image for Road to Genius: beginner #5
Ilya Nevolin
Ilya Nevolin

Posted on • Edited on

Road to Genius: beginner #5

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.

programming challenge

This is a nice and easy challenge. We are given three numbers (A, B, C), who are then used in a mathematical expression. The result of the expression is stored in variable R.

The buggy line we have is: let R = (☃️ + B + C) / 💧;
We also know that R = 5 (it's given), now we have to determine what ☃️ and 💧 should be. Since we have two unknowns but only one equation, we have to make a calculated guess. We see that A+B+C = 15. And since R has to be 5, then we can 💧 be 3, which is a possible answer in this case.

Note: we can ignore the Math.floor(R) code, it's used for rounding down decimal numbers; since 15 is a whole number it's irrelevant.

programming challenge answer

Great! On to the next one.


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)