educative.io

Educative

Base case missing

if n equal to 0 then this solution will return 0 instead of 1

“0” will not be valid input, as the problem expects only positive numbers:

For a given positive number N in base-10…

Posting as a reminder! :slight_smile:
Zero is neither a positive nor a negative number. Since the question mentions, Positive number N, zero is an invalid input in this case


Course: Grokking the Coding Interview: Patterns for Coding Questions - Learn Interactively
Lesson: Complement of Base 10 Number (medium) - Grokking the Coding Interview: Patterns for Coding Questions