EASYasked at 20 companies

Pascal's Triangle

A easy-tier problem at 77% community acceptance, tagged with Array, Dynamic Programming. Reported in interviews at HSBC and 19 others.

Founder's read

Pascal's Triangle is an easy problem that shows up in assessments at Google, Amazon, and a dozen other companies. The acceptance rate is 77%, but that number hides something: candidates who don't see the pattern spend way too long on a trivial problem. You generate rows of the triangle, each element the sum of the two above it. If you blank on the recurrence relation during a live OA, StealthCoder surfaces the solution in seconds while the proctor sees nothing but your code editor.

Companies asking
20
Difficulty
EASY
Acceptance
77%

Companies that ask "Pascal's Triangle"

If this hits your live OA

Pascal's Triangle 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. Made by an Amazon engineer who watched the leaked-problem repo become an industry secret. He decided you should have it too.

Get StealthCoder
What this means

The trap is overthinking it. You're not finding some clever mathematical formula. You're just building rows iteratively: start with [1], then each new row computes values as sums of adjacent pairs from the previous row. The algorithm is pure Array and Dynamic Programming, but candidates waste time searching for a closed-form solution or trying to optimize space when the straightforward approach already wins. Common pitfalls: off-by-one errors in loop bounds, forgetting to initialize the first and last elements of each row to 1, or misunderstanding what 'numRows' means. The problem is truly trivial once you see it, which is why it's a speed bump in real time. If you hit this in an assessment and panic, StealthCoder gives you a working solution instantly so you move on.

Pattern tags

The honest play

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

Pascal's Triangle 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. Made by an Amazon engineer who watched the leaked-problem repo become an industry secret. He decided you should have it too. Works on HackerRank, CodeSignal, CoderPad, and Karat.

Pascal's Triangle interview FAQ

How hard is Pascal's Triangle really?+

It's genuinely easy, but speed matters in a live OA. The acceptance rate of 77% reflects that most people solve it, but implementation errors and second-guessing cost time. Once you write it once, it takes five minutes max. The trick is not overthinking the math.

Do top companies like Google and Amazon still ask this?+

Yes. Google, Amazon, and eight others in this data set have reportedly asked it. It's a warm-up or a quick sanity check, not a hard problem. You're expected to solve it cleanly and move on.

What's the actual pattern I need to see?+

Each row is built from the previous one: new row's element at index i is previous[i-1] + previous[i]. The first and last elements of each row are always 1. That's it. No formula, just iteration and addition.

Is this Array or Dynamic Programming?+

Both. You're using an array to store previous rows (DP state), then building new rows based on old ones. It's DP in the sense that you reuse prior computation, but the label doesn't change how you solve it.

What's the most common mistake?+

Off-by-one errors in loop indices and forgetting to initialize row boundaries to 1. Candidates also sometimes try to modify the triangle in-place and corrupt earlier rows. Build each row fresh from the last one and you're safe.

Want the actual problem statement? View "Pascal's Triangle" 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.