Documentation IndexFetch the complete documentation index at: /llms.txtUse this file to discover all available pages before exploring further.
Fetch the complete documentation index at: /llms.txt
Use this file to discover all available pages before exploring further.
Tested Python solution for LeetCode 119 with 16 pytest cases. Generate a practice environment with lcpy.
lcpy gen -n 119 # by problem number lcpy gen -s pascals_triangle_ii # by problem name
rowIndex
rowIndexth
Input: rowIndex = 3 Output: [1,3,3,1]
Input: rowIndex = 0 Output: [1]
Input: rowIndex = 1 Output: [1,1]
O(rowIndex)
class Solution: # Time: O(n^2) # Space: O(n) def get_row(self, row_index: int) -> list[int]: row = [1] for _ in range(row_index): row.append(1) for i in range(len(row) - 2, 0, -1): row[i] += row[i - 1] return row