Default do not need username and password authenticate when access mongoDB ,I want to set up the user name & password for my mongoDB. so that any remo...
                            
                            
                                分类:
数据库   时间:
2014-07-03 21:02:37   
                                阅读次数:
343
                             
                    
                        
                            
                            
                                def sumS(s):
	if s  1:
		if cursum < s:
			last += 1
			cursum += last
		else:
			if cursum == s:
				re.append((...
                            
                            
                                分类:
其他好文   时间:
2014-07-03 16:42:24   
                                阅读次数:
190
                             
                    
                        
                            
                            
                                def q32(n, len):
	if n < 0:
		return 0
	elif n  0:
		if  n >= 1 and n < 10:
			total += 1
			return total
		p1 = n % (10**(len - 1))
		h = n / (10**(len - 1))
		...
                            
                            
                                分类:
编程语言   时间:
2014-07-03 16:04:12   
                                阅读次数:
288
                             
                    
                        
                            
                            
                                书里面关于分类的判断有些麻烦,通过某一位为0为1来对数组元素进行分类。假如第3位为1,那么也就是元素x & 8 等于或不等于0,所以没必要非的用第几位去判断。
def once(array):
	
	reOR = 0
	for x in array:
		reOR ^= x
		
	bit1 = firstBit1(reOR)
	first = 0
	second = 0
	for x in a...
                            
                            
                                分类:
其他好文   时间:
2014-07-03 13:54:06   
                                阅读次数:
182
                             
                    
                        
                            
                            
                                The 10,000-Hour Rule says that you need approximately 10,000 hours of practice to become a world-class expert in a field. There is no other way: if yo...
                            
                            
                                分类:
其他好文   时间:
2014-07-03 12:25:37   
                                阅读次数:
214
                             
                    
                        
                            
                            
                                转载请注明出处:http://blog.csdn.net/ns_code/article/details/28113959 剑指offer上的最后一题了,一个递归函数调了一下午,才得到正确的结果。题目描写叙述:给定一棵树,同一时候给出树中的两个结点,求它们的最低公共祖先。输入:输入可能包括多个測试....
                            
                            
                                分类:
其他好文   时间:
2014-07-02 18:31:14   
                                阅读次数:
229
                             
                    
                        
                            
                            
                                题目如下:
Dungeon Master 
You are trapped in a 3D dungeon and need to find the quickest way out!The dungeon is composedof unit cubes which may or may not be filled with rock. It ...
                            
                            
                                分类:
其他好文   时间:
2014-07-02 16:53:39   
                                阅读次数:
199
                             
                    
                        
                            
                            
                                分析:
假如给定的数组中的元素是1-9之间的数,我们怎么来处理呢?比如[ 1,4,7,9,3,8],很简单,排个序,就是134789。
这里不同的一点就是,给定的数稍微复杂一点,不再单纯的是1位的数,[3,32,321] 这种情况也会出现。我们还想用排序,那么就需要自己制定下排序规则,也就是比较的标准。
str1和str2 长度相同的比较就不说了,在长度不同的时候,我们将长度短的用最后一位进...
                            
                            
                                分类:
其他好文   时间:
2014-07-02 11:47:35   
                                阅读次数:
209
                             
                    
                        
                            
                            
                                题目:输入某二叉树的前序遍历和中序遍历的结果,请重建出该二叉树。...
                            
                            
                                分类:
其他好文   时间:
2014-07-02 08:58:17   
                                阅读次数:
198
                             
                    
                        
                            
                            
                                题目:用两个栈实现一个队列。队列的声明如下:请实现它的两个函数appendTail和deleteHead,分别完成在队列尾部插入结点和在队列头部删除结点的功能。
分析:
队列的特点是“先进先出”,而栈的特点是“先进后出”。要用两个栈来实现队列。用图分析如下:
程序代码如下:
#include 
#include 
#include 
#ifndef ERROR
#define E...
                            
                            
                                分类:
其他好文   时间:
2014-07-02 08:00:24   
                                阅读次数:
247