FunctionRacerProblemsRace

Staircase of Stones

BeginnerMathPython, JavaScript, TypeScript, Java, C++

A pyramid is built in rows: the top row has 1 stone, the next row 3 stones, then 5, 7, and so on (odd numbers). Return the total number of stones needed for a pyramid of rows rows.

Example 1

rows 3
returns 9

1 + 3 + 5 = 9.

Constraints

Race itor take your time

Write it in your browser, against the clock. The model solution, stepped through line by line, comes after.

More Math problems