Sum of Cubes up to N

Given a non-negative integer n, return 1³ + 2³ + ... + n³. When n is 0, the range is empty and the answer is 0.

Given a non-negative integer `n`, return `1³ + 2³ + ... + n³`. When `n` is `0`, the range is empty and the answer is `0`.

- `0 <= n <= 50` - The answer fits within a 32-bit signed integer.

Example 1: input n = 3; output 36. 1³ + 2³ + 3³ = 36.

Example 2: input n = 0; output 0. The range has no terms.

Example 3: input n = 4; output 100. 1 + 8 + 27 + 64 = 100.

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