EASYasked at 4 companies

Pascal's Triangle II

A easy-tier problem at 66% community acceptance, tagged with Array, Dynamic Programming. Reported in interviews at Goldman Sachs and 3 others.

Founder's read

Pascal's Triangle II asks you to return a specific row from Pascal's Triangle given only the row index. The catch: you need to do it efficiently without building the entire triangle. This problem shows up in assessments at Google, Meta, Goldman Sachs, and Yahoo. It tests whether you understand the underlying pattern and can optimize for space. Most candidates either generate the full triangle (wasteful) or miss that each element depends only on the previous row. The acceptance rate is around 66%, which means a solid chunk of people either solve it quickly or get stuck on optimization.

Companies asking
4
Difficulty
EASY
Acceptance
66%

Companies that ask "Pascal's Triangle II"

If this hits your live OA

Pascal's Triangle II is the kind of problem that decides whether you pass. StealthCoder reads the problem on screen and surfaces a working solution in under 2 seconds. Invisible to screen share. The proctor sees nothing. Built by an Amazon engineer who used it to pass JPMorgan's OA and system design loop.

Get StealthCoder
What this means

The naive approach builds all rows up to your target, which works but uses O(n) space unnecessarily. The real pattern: each row only needs the previous row to compute. You can build row by row and overwrite your working array, cutting space down to O(n). The trick most people miss on their first attempt is the direction you iterate when updating values in place. Start from the right and work backward to avoid overwriting values you still need. This is a classic dynamic programming optimization problem that's easy conceptually but catches careless coders. If you blank on the iteration order during your live OA, StealthCoder solves it in seconds without the proctor seeing.

Pattern tags

The honest play

You know the problem. Make sure you actually pass it.

Pascal's Triangle II recycles across companies for a reason. It's easy-tier, and most candidates blank under the timer. StealthCoder is the hedge: an AI overlay invisible during screen share. It reads the problem and surfaces a working solution in under 2 seconds. Built by an Amazon engineer who used it to pass JPMorgan's OA and system design loop. Works on HackerRank, CodeSignal, CoderPad, and Karat.

Pascal's Triangle II interview FAQ

Why can't I just generate all rows up to n?+

You can, but it wastes O(n^2) space when you only need O(n). The assessment will pass, but optimal solutions generate one row at a time, overwriting it as you go. If space efficiency matters in the scoring, naive code gets flagged.

Is this really asked at big companies?+

Yes. Google, Meta, Goldman Sachs, and Yahoo have all asked it. It's typically an easy warmup or a second problem in a two-problem round. The acceptance rate is 66%, so you're competing against people who know the trick.

What's the gotcha with updating in place?+

If you iterate left-to-right, you overwrite values you still need for the next calculation. Iterate right-to-left instead. Each new value depends only on the two values directly above it in the previous row, so backward iteration preserves them.

Do I need to understand the math behind Pascal's Triangle?+

No. You just need to know that each element is the sum of the two elements above it. If you're comfortable with that relationship, the DP solution follows naturally. No combinatorics required.

How hard is this compared to other Array/DP problems?+

It's marked EASY and has a 66% acceptance rate, so it's genuinely easier than most. If you've drilled the pattern once, it's a gimme. If you haven't, the iteration order can trip you up live.

Want the actual problem statement? View "Pascal's Triangle II" on LeetCode →

Frequency and company-tag data sourced from public community-maintained interview-report repos. Problem, description, and trademark © LeetCode. StealthCoder is not affiliated with LeetCode.