911. Check if a Number is a Strong Number
Given a positive integer N, determine whether it is a Strong Number or not.
A number is considered a Strong Number if the sum of the factorial of its digits is equal to the number itself.
Return "Yes" if the number is a Strong Number, else return "No".
Example 1:
Input: 145
Output: Yes
Explanation:
- 1! + 4! + 5! = 1 + 24 + 120 = 145, so it is a Strong Number.
Example 2:
Input: 26
Output: No
Explanation: 2! + 6! = 2 + 720 = 722 ≠ 26.
Now Your Turn!
Pick the correct output for the given inputInput: 2
Still unsure what the problem is asking ?
Let’s go through a few more examples, step by step, to make it clearer.
Constraints:
- 1 ≤ N ≤ 10⁵
- You must compute factorials without using any prebuilt math library.