This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Solution(object): | |
def generate(self, numRows): | |
""" | |
:type numRows: int;; rtype: List[List[int]] | |
""" | |
if not numRows: return [] | |
ret = [[1]] | |
numRows -= 1 | |
while numRows: | |
ret.append([1] + [a+b for a,b in zip(ret[-1][:-1], ret[-1][1:])] +[1]) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import random | |
class Solution: | |
# @param {int} n a positive integer | |
# @param {int} k a positive integer | |
# @return {Solution} a Solution object | |
@classmethod | |
def create(cls, n, k): | |
# Write your code here | |
t = cls(n, k) |