← ALL NOTES
Array

119. Pascal's Triangle II

No need to store the whole triangle — evolve a single array from one row to the next in place. The key is to update right to left: row[j] += row[j-1]. Sweeping backward means that when you compute…

Loading…