Skip to content

Instantly share code, notes, and snippets.

View quake0day's full-sized avatar
😎
..

Si Chen quake0day

😎
..
View GitHub Profile
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])
@quake0day
quake0day / py
Created March 20, 2016 21:52
Consistent Hashing II - Python_TLE
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)