Check if a Number is Strong

Given a positive integer n, return true if the sum of the factorials of its decimal digits equals n; otherwise return false. Such a value is called a strong…

Given a positive integer `n`, return `true` if the sum of the factorials of its decimal digits equals `n`; otherwise return `false`. Such a value is called a strong or Krishnamurthy number. For example, `145` is strong because `1! + 4! + 5! = 1 + 24 + 120 = 145`.

- `1 ≤ n ≤ 10^5` - `n` is always a positive integer.

Example 1: input n = 145; output true. 1! + 4! + 5! equals 145.

Example 2: input n = 123; output false. 1! + 2! + 3! equals 9, not 123.

Example 3: input n = 2; output true. The single contribution 2! equals 2.

Category: Math. Topic: math. Difficulty: Easy. Patterns: math.