Array
118. Pascal's Triangle
Each row is built from the one above it: interior entries are row[j] = prev[j-1] + prev[j], and the two ends are always 1. Initialize each new row filled with 1s — that sets the edges for free — then…
Loading…
Each row is built from the one above it: interior entries are row[j] = prev[j-1] + prev[j], and the two ends are always 1. Initialize each new row filled with 1s — that sets the edges for free — then…
Loading…