前言:自我介绍信通小本,北京人,成绩中上,也拿过三年的奖学金,但编程能力不强,天赋有限,大二时便决定放弃技术类工作。常自省,多实践,自大一开始实习,前后有五次实习经历,其中,一次创新工场产品实习经历,和一次互联网创业经历。找工作前,算是一个入门级PM。第一部分:求职数字获得的offer:网易、腾讯、...
                            
                            
                                分类:
其他好文   时间:
2014-07-06 14:48:26   
                                阅读次数:
204
                             
                    
                        
                            
                            
                                与折半查找是同一个模式,不同的是,在这里不在查找某个确定的值,而是查找确定值所在的上下边界。
def getBounder(data, k, start, end, low_bound = False):
	if end < start : return -1
	while start > 1
		if data[ mid ] ...
                            
                            
                                分类:
其他好文   时间:
2014-07-06 12:18:00   
                                阅读次数:
311
                             
                    
                        
                            
                            
                                可以练习下链表的逆置。
def PrintListReversingly(head):
	if head == None:
		return
	if head:
		PrintListReversingly(head.next)
	print head.val
def reverse(head):
	if head == None or head.next == None:
		return...
                            
                            
                                分类:
其他好文   时间:
2014-07-06 09:29:57   
                                阅读次数:
214
                             
                    
                        
                            
                            
                                class BTNode:
	def __init__(self, val):
		self.left = None
		self.right = None
		self.val = val
'''
@ construct tree by inorder & preorder
'''
def constructByInPre(inorder, instart, inend, preorde...
                            
                            
                                分类:
其他好文   时间:
2014-07-06 00:34:00   
                                阅读次数:
234
                             
                    
                        
                            
                            
                                For the exercises in this chapter we need a list of English words. There are lots of word lists available on the Web, but the most suitable for our pu...
                            
                            
                                分类:
其他好文   时间:
2014-07-05 22:45:55   
                                阅读次数:
545
                             
                    
                        
                            
                            
                                def IsContinuous(seq, num = 5):
	zeros = 0; d = 0
	seq = sorted(seq)
	for i in range(num - 1):
		if seq[i] == 0:
			zeros += 1
			continue
		if seq[i] == seq[i + 1]:
			return False
		d += seq[i + 1]...
                            
                            
                                分类:
其他好文   时间:
2014-07-04 07:11:20   
                                阅读次数:
171
                             
                    
                        
                            
                            
                                题目要求第n个丑数,所以对于中间结果不需要保存。
def Humble(index):
	curHum = 1
	M2 = 2; M3 = 3; M5 = 5
	while index > 1:
		curHum = min(min(M2, M3), M5)
		while M2 <= curHum:
			M2 *= 2
		while M3 <= curHum:
			M3 *= 3
		w...
                            
                            
                                分类:
其他好文   时间:
2014-07-03 17:29:40   
                                阅读次数:
214
                             
                    
                        
                            
                            
                                SPOJ Problem Set (classical)
694. Distinct Substrings
Problem code: DISUBSTR
Given a string, we need to find the total number of its distinct substrings.
Input
T- number of ...
                            
                            
                                分类:
其他好文   时间:
2014-07-03 16:32:42   
                                阅读次数:
212
                             
                    
                        
                            
                            
                                CD 
You have a long drive by car ahead. You have a tape recorder, but unfortunately your best music is on CDs. You need to have it on tapes so the problem to solve is: you have a tape N min...
                            
                            
                                分类:
其他好文   时间:
2014-07-03 15:34:36   
                                阅读次数:
176
                             
                    
                        
                            
                            
                                按着书里面讲述的方法,根据某一位来将整个数组拆分成两个部分,取每一部分中出现一次的数。书中的处理略显复杂,这里简化下分类的方法。
def once(array):
	
	reOR = 0
	for x in array:
		reOR ^= x
		
	bit1 = firstBit1(reOR)
	first = 0
	second = 0
	for x in array:
		if x & ...
                            
                            
                                分类:
其他好文   时间:
2014-07-03 13:50:52   
                                阅读次数:
181