Dsa
Recursion
Warm-up
Calculate Factorial
Write a function that calculates the factorial of a non-negative integer using recursion. For example, given the input '5', the output should be '120'.
Example Input:
5
Example Output:
120
Key concepts
recursionbasic math
Practise this out loud — free
Start a mock interview on THIS exact question — a voice AI interviewer opens with it, pushes back like a real onsite, then hands you an instant scorecard.
🎙 Practise this question now