0 out of 464 challenges solved
### Problem Statement
Write a Python function `last_digit_factorial(n)` that computes the last digit of the factorial of a given non-negative integer `n`.
The factorial of a number `n` is the product of all positive integers less than or equal to `n`. For example:
- `5! = 5 × 4 × 3 × 2 × 1 = 120`
The last digit of `5!` is `0`.
#### Function Signature
```python [main.nopy]
def last_digit_factorial(n: int) -> int:
pass
```
#### Input
- `n` (int): A non-negative integer.
#### Output
- (int): The last digit of the factorial of `n`.
#### Examples
```python [main.nopy]
last_digit_factorial(4) # Output: 4
last_digit_factorial(5) # Output: 0
last_digit_factorial(10) # Output: 0
```
#### Constraints
- The input `n` will be a non-negative integer.
- The function should handle large values of `n` efficiently.def last_digit_factorial(n: int) -> int:
"""
Calculate the last digit of the factorial of a given number.
Args:
n (int): A non-negative integer.
Returns:
int: The last digit of the factorial of n.
"""
# Placeholder for the solution
pass