PracHub
QuestionsPremiumLearningGuidesInterview PrepNEWCoaches
|Home/Coding & Algorithms/Other

Return the k-th row of Pascal-like triangle

Last updated: Mar 29, 2026

Quick Overview

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.

  • medium
  • Other
  • Coding & Algorithms
  • Software Engineer

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.

Related Interview Questions

  • Implement a multi-button click detector - Other (hard)
  • Compute total after discounting most expensive item - Other (medium)
  • Implement multiplication without using the multiplication operator - Other (Medium)
  • Prove reservoir sampling correctness - Other (Medium)
  • Write mini-batch gradient descent - Other (Medium)
Other logo
Other
Jan 21, 2026, 12:00 AM
Software Engineer
Take-home Project
Coding & Algorithms
1
0
Loading...

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]

Comments (0)

Sign in to leave a comment

Loading comments...

Browse More Questions

More Coding & Algorithms•More Other•More Software Engineer•Other Software Engineer•Other Coding & Algorithms•Software Engineer Coding & Algorithms
PracHub

Master your tech interviews with 7,500+ real questions from top companies.

Product

  • Questions
  • Learning Tracks
  • Interview Guides
  • Resources
  • Premium
  • For Universities
  • Student Access

Browse

  • By Company
  • By Role
  • By Category
  • Topic Hubs
  • SQL Questions
  • Compare Platforms
  • Discord Community

Support

  • support@prachub.com
  • (916) 541-4762

Legal

  • Privacy Policy
  • Terms of Service
  • About Us

© 2026 PracHub. All rights reserved.