FunctionRacerProblemsRace

Pascal Row

EasyArraysPython, JavaScript, TypeScript, Java, C++

In Pascal's triangle every row starts and ends with 1, and each other number is the sum of the two numbers above it in the previous row. Row 0 is [1], row 1 is [1, 1], row 2 is [1, 2, 1].

Return the row with index rowIndex.

Example 1

rowIndex 3
returns [1,3,3,1]

Row 3 is [1, 3, 3, 1].

Example 2

rowIndex 0
returns [1]

Row 0 is [1].

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 Arrays problems