DEV Community πŸ‘©β€πŸ’»πŸ‘¨β€πŸ’»

Cover image for Road to Genius: genius #69
Ilya Nevolin
Ilya Nevolin

Posted on

Road to Genius: genius #69

Each day I solve several coding 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, and you will learn a ton of new and interesting things as you go.

function TZ(n) {
  let N = 0;
  while (n >= 5) {
    N += 😈.floor(🍎 / πŸ’§);
    n = πŸ’°.floor(n / 5);
  }
  return N;
}
;
let A = TZ(TZ(TZ(12200)));

// πŸ’° = ? (identifier)
// 😈 = ? (identifier)
// 🍎 = ? (identifier)
// πŸ’§ = ? (number)
// such that A = 188 (number)
Enter fullscreen mode Exit fullscreen mode

Here's an interesting challenge, we have to fix 4 bugs in a pretty short code base.

All four bugs appear on two sequential lines. We immediately see that 😈 and πŸ’° should be Math because they use the common floor function. The final two bugs 🍎 and πŸ’§ are tricky to find. However, if we look at the possible answers for πŸ’§ (number) it shows 12200, 5 and 0; dividing by 12200 and 0 makes little sense, but dividing by 5 is also done on the next line of code. Since πŸ’§ is likely to be 5, then 🍎 could be n for the same reason:

coding challenge answer

By solving these challenges you train yourself to be a better programmer. You'll learn newer and better ways of analyzing, debugging and improving code. As a result you'll be more productive and valuable in business. Get started and become a certified Codr today at https://nevolin.be/codr/

Top comments (0)

🌚 Friends don't let friends browse without dark mode.

Good news! You can update to dark mode in your DEV settings.