I found this question in challenge but I can't understand how it got 24. What I missed? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

I found this question in challenge but I can't understand how it got 24. What I missed?

https://code.sololearn.com/wb7f9FG0ihct/?ref=app

9th Dec 2022, 3:08 PM
Francesco Russo
2 Answers
+ 4
Here's a step-by-step breakdown of the calculation: f(4) is called and returns 4 * f(3) f(3) is called and returns 3 * f(2) f(2) is called and returns 2 * f(1) f(1) is called and returns 1 The recursive calls start unwinding, with f(2) returning 2 * 1 = 2, f(3) returning 3 * 2 = 6, and f(4) returning 4 * 6 = 24. This is the final result that is output by the code.
9th Dec 2022, 3:14 PM
Calviղ
Calviղ - avatar
+ 2
Than you!
9th Dec 2022, 3:18 PM
Francesco Russo