Return the k-th row of Pascal-like triangle
Company: Other
Role: Software Engineer
Category: Coding & Algorithms
Difficulty: medium
Interview Round: Take-home Project
## Problem
Given an integer `rowIndex` (0-indexed), return the `rowIndex`-th row of Pascal’s triangle.
Pascal’s triangle is defined as:
- Row 0 is `[1]`
- Each subsequent row starts and ends with `1`
- Each interior element is the sum of the two elements directly above it:
- `row[i][j] = row[i-1][j-1] + row[i-1][j]`
### Input
- `rowIndex`: integer (`>= 0`)
### Output
- An array/list of length `rowIndex + 1` containing the values in that row.
### Constraints (memory-focused)
- `0 <= rowIndex <= 10^5`
- You should use **O(rowIndex)** extra space (a full 2D triangle may exceed memory limits).
### Example
- `rowIndex = 4` → `[1, 4, 6, 4, 1]`
Quick Answer: This question evaluates combinatorics, array manipulation, and space-efficient algorithm design by requiring computation of a specific row of Pascal’s triangle without constructing the full triangle.