xamples
epeat
ode
pproach
ptimize
est
Given a value, n, construct a flat array of the values in Pascal's Triangle to that depth.
1. Start with an empty array to hold your values.
2. Iterate n times (the depth of the triangle)
3. In a nested for-loop, iterate i + 1 times (each row has i + 1 elements)
4. Insert a 1 if you are at an edge, otherwise calculate an interior value
Extra Credit:
If your interviewee solves the answer quickly, have them design an algorithm that will print the triangle like this
Solution : https://repl.it/BhFY/1
Solution (Binomial): https://repl.it/BhIQ
By ryankdwyer
Technical interview problem on generating string permutations