FastPrepPascal's Triangle
Problems/Pascal's Triangle

Pascal's Triangle

Bloomberg LP logoBloomberg LP● EasyNEW GRADPHONE SCREENONSITE INTERVIEW

Updated Dec 2026

QuestionFunctionExamplesConstraints

Problem statement

Source note: Bloomberg new-grad reports name this exact well-known problem. Our version is about 100% the same as the reported question.

Given a nonnegative integer numRows, return the first numRows rows of Pascal's Triangle.

Rows are zero-indexed. Row i contains i + 1 values; its first and last values are 1, and every interior value equals the sum of the two values above it.

Function

solvePascalsTriangle(numRows: int) → int[][]

Examples

Example 1

numRows = 5return = [[1], [1, 1], [1, 2, 1], [1, 3, 3, 1], [1, 4, 6, 4, 1]]

Each row begins and ends with 1; every interior value is the sum of its two parents from the preceding row.

Example 2

numRows = 0return = []

Zero requested rows produce an empty triangle.

Example 3

numRows = 1return = [[1]]

The first row contains only the boundary value 1.

Constraints

  • 0 <= numRows <= 30.
  • Return an empty matrix when numRows = 0.

More Bloomberg LP Onsite Interview questions

  • Valid Triangle NumberPHONE SCREEN · ONSITE INTERVIEW · Seen Dec 2026
  • Collatz Conjecture with Shared MemoizationPHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
  • Word SearchOA · PHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
  • N-ary Index-Path Encoder and DecoderPHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
  • Top K Frequent WordsONSITE INTERVIEW · Seen Nov 2026
  • Trapping Rain WaterPHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
  • Design Browser HistoryPHONE SCREEN · ONSITE INTERVIEW · Seen Oct 2026
  • Mutable Stock Price Top KPHONE SCREEN · ONSITE INTERVIEW · Seen Oct 2026
  • Add Two Numbers IIPHONE SCREEN · ONSITE INTERVIEW · Seen Oct 2026
  • Decode StringPHONE SCREEN · ONSITE INTERVIEW · Seen Oct 2026

Similar questions at other companies

  • Best Time to Buy and Sell StockAmazon · ONSITE INTERVIEW
  • Best Time to Buy and Sell StockMeta · PHONE SCREENMeta interview questions
  • Speed Up a Slow FunctionCitadel · OA · PHONE SCREENCitadel interview questions
  • Best Time to Buy and Sell StockSwiggy · PHONE SCREEN
  • Best Time to Buy and Sell StockKotak Mahindra Bank · ONSITE INTERVIEWKotak Mahindra Bank interview questions
  • Suffix Maximum Frequency QueriesMicrosoft · PHONE SCREENMicrosoft interview questions
  • Best Time to Buy and Sell StockOracle · PHONE SCREEN · ONSITE INTERVIEWOracle interview questions
  • Maximum SubarraySquarepoint Capital · ONSITE INTERVIEWSquarepoint Capital interview questions
  • Best Time to Buy and Sell StockJP Morgan Chase · PHONE SCREENJP Morgan Chase interview questions
  • Best Time to Buy and Sell StockZoox · ONSITE INTERVIEW

Bloomberg LP interview experiences

  • Bloomberg AI-Assisted Coding Round, All Levels: 14 Experiences
  • Bloomberg SWE Intern Interview Questions: 68 Questions
  • Bloomberg Interview Questions, Level Not Reported: 65 Questions
  • Bloomberg Experienced Design & More: 126 Questions (Part 2 of 2)
  • Bloomberg Experienced SWE Interviews: 167 Questions (Part 1 of 2)
  • Bloomberg New Grad Coding Questions: 121 Questions (Part 2 of 2)
All Bloomberg LP interview questionsSee Bloomberg LP hiring insights
Saved
class Solution {
    public int[][] solvePascalsTriangle(int numRows) {
        // write your code here
    }

}
Checking account…