Return the k-th row of Pascal-like triangle
Company: Other
Role: Software Engineer
Category: Coding & Algorithms
Difficulty: medium
Interview Round: Take-home Project
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.
Constraints
- rowIndex >= 0
Examples
Input: (0,)
Expected Output: [1]
Explanation: First row.
Input: (1,)
Expected Output: [1, 1]
Explanation: Second row.
Input: (4,)
Expected Output: [1, 4, 6, 4, 1]
Explanation: Example row.
Input: (6,)
Expected Output: [1, 6, 15, 20, 15, 6, 1]
Explanation: Larger row.
Hints
- Update a one-dimensional row from right to left.