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)
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:
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)