Given a sorted array that has been rotated serveral times. Write code to find an element in this array. You may assume that the array was originally s...
分类:
其他好文 时间:
2014-07-11 23:02:53
阅读次数:
254
exists keydel key1 key2Redis 的vauleredis 提供五种数据类型:string,hash,list,set 及sorted set。string 是最基本的类型,而且string 类型是二进制安全的。意思是redis 的string 可以包含任何数据。比如jpg 图...
分类:
其他好文 时间:
2014-07-11 12:38:31
阅读次数:
239
大部分人都知道redis是一款用在缓存服务器上的软件,它与memcache类似,都可以存储海量的数据,用在大访问量的web网站、聊天记录存放等方面,但是又与memcache不同:1、缓存数据可以持久化,没有缓存时间限制2、支持更多的数据类型:string、list 、set 、sorted set ...
分类:
Web程序 时间:
2014-07-11 10:33:37
阅读次数:
208
1.利用荷兰国旗的思路,每次记住最后一个位置,遇到一个不重复的数,放在它后面,代码很简单。Given a sorted array, remove the duplicates in place such that each element appear onlyonceand return the...
分类:
编程语言 时间:
2014-07-11 09:42:49
阅读次数:
238
题目:Given two sorted integer arrays A and B, merge B into A as one sorted array.Note:You may assume that A has enough space (size that is greater or eq...
分类:
其他好文 时间:
2014-07-10 14:41:23
阅读次数:
177
[LeetCode]Merge Sorted Array...
分类:
其他好文 时间:
2014-07-09 11:15:07
阅读次数:
221
[LeetCode]Remove Duplicates from Sorted Array...
分类:
其他好文 时间:
2014-07-08 16:07:52
阅读次数:
192
把一个排好序的vector转换为一颗二分查找树。很简单的题目,递归即可,保证边界不要出错。 1 /** 2 * Definition for binary tree 3 * struct TreeNode { 4 * int val; 5 * TreeNode *left; ...
分类:
其他好文 时间:
2014-07-06 12:53:50
阅读次数:
174
There are two sorted arrays A and B of size m and n respectively.
Find the median of the two sorted arrays.
The overall run time complexity should be O(log (m+n)).
有两个已排序的数组A和B,大小为m 和 n。
找出两数组的中...
分类:
其他好文 时间:
2014-07-05 22:54:17
阅读次数:
244
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