上一页 1 ··· 9 10 11 12 13 14 下一页

2018年9月25日

摘要: class Empty(Exception): pass class Linklist: class _Node: # Nonpublic class for storing a linked node __slots__='_element','_next' def __init__(self,ele,ne): self._element=ele self._... 阅读全文
posted @ 2018-09-25 11:32 chiyeung 阅读(100) 评论(0) 推荐(0) 编辑

2018年9月24日

摘要: On a N * N grid, we place some 1 * 1 * 1 cubes that are axis-aligned with the x, y, and z axes. Each value v = grid[i][j] represents a tower of v cube 阅读全文
posted @ 2018-09-24 12:45 chiyeung 阅读(223) 评论(0) 推荐(0) 编辑

2018年9月23日

摘要: A self-dividing number is a number that is divisible by every digit it contains. For example, 128 is a self-dividing number because 128 % 1 == 0, 128 阅读全文
posted @ 2018-09-23 13:49 chiyeung 阅读(201) 评论(0) 推荐(0) 编辑

2018年9月22日

摘要: Given an array of 2n integers, your task is to group these integers into n pairs of integer, say (a1, b1), (a2, b2), ..., (an, bn) which makes sum of 阅读全文
posted @ 2018-09-22 16:13 chiyeung 阅读(84) 评论(0) 推荐(0) 编辑
摘要: There are two direction for us to solve this problem. (1) Recursion Recursive step: T[0] conbines with findsubsets(T[1:]) Final step: if len(T)==0: re 阅读全文
posted @ 2018-09-22 10:32 chiyeung 阅读(125) 评论(0) 推荐(0) 编辑

2018年9月21日

摘要: Given a binary matrix A, we want to flip the image horizontally, then invert it, and return the resulting image. To flip an image horizontally means t 阅读全文
posted @ 2018-09-21 12:59 chiyeung 阅读(118) 评论(0) 推荐(0) 编辑
摘要: def permutationN(n): a=[None]*n for i in range(n): a[i]=i+1 sum=1 for j in range(n): sum*=(j+1) i=0 for k in range(sum): # If you want to use stack #a[i:i+2]=swapStack(a[i],a[i+1]) ... 阅读全文
posted @ 2018-09-21 12:49 chiyeung 阅读(147) 评论(0) 推荐(0) 编辑

2018年9月19日

摘要: The Hamming distance between two integers is the number of positions at which the corresponding bits are different. Given two integers x and y, calcul 阅读全文
posted @ 2018-09-19 16:03 chiyeung 阅读(98) 评论(0) 推荐(0) 编辑
摘要: In a 2 dimensional array grid, each value grid[i][j] represents the height of a building located there. We are allowed to increase the height of any n 阅读全文
posted @ 2018-09-19 15:45 chiyeung 阅读(103) 评论(0) 推荐(0) 编辑

2018年9月17日

摘要: International Morse Code defines a standard encoding where each letter is mapped to a series of dots and dashes, as follows: "a"maps to ".-", "b" maps 阅读全文
posted @ 2018-09-17 13:08 chiyeung 阅读(99) 评论(0) 推荐(0) 编辑
上一页 1 ··· 9 10 11 12 13 14 下一页

导航