Check if a Number is Pronic
Given a non-negative integer n, return true when n is the product of two consecutive non-negative integers; otherwise return false. For example, 20 = 4 × 5,…
Given a non-negative integer `n`, return `true` when `n` is the product of two consecutive non-negative integers; otherwise return `false`. For example, `20 = 4 × 5`, so 20 is pronic.
- `0 ≤ n ≤ 10^6` - `n` is always an integer.
Example 1: input n = 20; output true. 20 = 4 × 5.
Example 2: input n = 0; output true. 0 = 0 × 1.
Example 3: input n = 21; output false. No consecutive non-negative integers multiply to 21.
Category: Math. Topic: math. Difficulty: Easy. Patterns: math.