Check if a Number is Disarium

Given a non-negative integer n, return true when the sum of each decimal digit raised to its one-based position equals n; otherwise return false. Positions…

Given a non-negative integer `n`, return `true` when the sum of each decimal digit raised to its one-based position equals `n`; otherwise return `false`. Positions are counted from left to right. For example, `135 = 1¹ + 3² + 5³`.

- `0 ≤ n ≤ 10^9` - `n` is always an integer.

Example 1: input n = 135; output true. 1¹ + 3² + 5³ = 135.

Example 2: input n = 89; output true. 8¹ + 9² = 89.

Example 3: input n = 136; output false. 1¹ + 3² + 6³ = 226, not 136.

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