Given an unsorted array of integers, find the
length of the longest consecutive elements sequence.For example,Given[100, 4,
200, 1, 3, 2],The longest ...
分类:
其他好文 时间:
2014-07-22 23:16:14
阅读次数:
408
Given a string, find the length of the longest
substring without repeating characters. For example, the longest substring
without repeating letters fo...
分类:
其他好文 时间:
2014-07-22 23:11:32
阅读次数:
388
整理自统计之都论坛
方法一 使用strsplit函数
a <- "aggcacggaaaaacgggaataacggaggaggacttggcacggcattacacggagg"
b <- strsplit(as.character(a),"ag")
length(b[[1]]) - 1 ##子字符串"ag"的出现个数
方法二 使用正则式函数
a <- "aggcacgg...
分类:
其他好文 时间:
2014-07-22 23:02:52
阅读次数:
288
1 //桶排序思想 2 //假如要排序的是数字是 2 4 5 5 5 8 8 9 1 1 3
#include 4 #define length 10 5 int main() 6 { 7 //数组元素值全部初始化为0 8 int
array[length]={0}; 9 ...
分类:
其他好文 时间:
2014-05-01 22:19:46
阅读次数:
342
题目: Given a string S, find the longest palindromic
substring in S. You may assume that the maximum length of S is 1000, and there
exists one unique lo...
分类:
其他好文 时间:
2014-05-01 20:07:13
阅读次数:
429
/**js Unicode编码转换*/vardecToHex =function(str)
{varres=[];for(vari=0;i < str.length;i++)
res[i]=("00"+str.charCodeAt(i).toString(16)).slice(-4);return"...
分类:
Web程序 时间:
2014-05-01 19:36:51
阅读次数:
427
获取字符串长度%x="abcd"#方法一%expr length $x4# 方法二%echo
${#x}4# 方法三%expr "$x" : ".*"4# expr 的帮助# STRING : REGEXP anchored pattern match
of REGEXP in STRING查找子串...
分类:
其他好文 时间:
2014-05-01 02:54:16
阅读次数:
404
冒泡排序
思路:就是每次将最大或最小的元素放到数组的最后,so easy!时间复杂度为(O(n^2))
public class BubbleSort {
public static void bubbleSort(int[] a) {
for (int j = 1; j < a.length; j++) {
for (int i = 0; i < a.length - j; i+...
分类:
编程语言 时间:
2014-04-30 22:12:40
阅读次数:
309
Given a string, find the length of the longest substring without repeating characters. For example, the longest substring without repeating letters for "abcabcbb" is "abc", which the length is 3....
分类:
其他好文 时间:
2014-04-29 13:47:20
阅读次数:
251
使用函数操作链表
1:计算链表中结点的个数:定义一个Length_list()函数用于计算链表中结点的个数
函数代码:
//计算链表中结点的个数
void Length_list(PNODE pHead)
{
PNODE p = pHead->pNext;
int len = 0;
while(NULL != p)
{
len++;
p = p->pNext;
...
分类:
其他好文 时间:
2014-04-29 13:28:21
阅读次数:
302