Given an array of non-negative integers, you
are initially positioned at the first index of the array.Each element in the
array represents your maximu...
分类:
其他好文 时间:
2014-05-19 08:07:26
阅读次数:
288
题目:合并两个有序单链表思路:一开始想复杂了,以为必须在原链表上修改(绕来绕去还AC了,但是思路相当绕),其实没有,按照正常地合并两个数组同样的方法也对。代码:public
ListNode mergeTwoLists(ListNode l1, ListNode l2) { if(l1 ...
分类:
其他好文 时间:
2014-05-19 07:48:32
阅读次数:
314
Say you have an array for which theithelement
is the price of a given stock on dayi.If you were only permitted to complete at
most one transaction (ie...
分类:
其他好文 时间:
2014-05-18 20:30:16
阅读次数:
301
早上公交上总想这个问题,终于写出来了,不知道有错误没 1 $chinese =
array("零","一","二","三","四","五","六","七","八","九"); 2 $str = 140032002005; 3 $arr =
array(); 4 ...
分类:
其他好文 时间:
2014-05-18 19:27:44
阅读次数:
262
【题目】
Given an array and a value, remove all instances of that value in place and return the new length.
The order of elements can be changed. It doesn't matter what you leave beyond the new length.
【题意】
删除数组中指定的值。不关心在新数组的后面即数组尾部留下了什么值。
【思路】
思路同Remo...
分类:
其他好文 时间:
2014-05-18 14:53:56
阅读次数:
208
【题目】
Implement next permutation, which rearranges numbers into the lexicographically next greater permutation of numbers.
If such arrangement is not possible, it must rearrange it as the lowest possible order (ie, sorted in ascending order).
The replac...
分类:
其他好文 时间:
2014-05-18 09:54:53
阅读次数:
242
创建 Array 对象的语法:var array = []; var array new
Array();var array new Array(size); // length = sizevar array new Array(element0,
element1, ..., elementn)...
分类:
编程语言 时间:
2014-05-18 02:22:39
阅读次数:
314
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-05-18 01:52:45
阅读次数:
317
Remove Duplicates from Sorted List IGiven a
sorted linked list, delete all duplicates such that each element appear only
once.For example,Given 1->1->...
分类:
其他好文 时间:
2014-05-18 01:41:31
阅读次数:
361
1:array_shift():调用了方法是把第一个值移除(算法:先进先出)2:array_pop():调用了方法是把最后一个移除,但是返回的是最后一值(算法:后进先出)3:mysql_affected_rows():表示几行受影响,成功,肯定是大于0,否则失败4:正则表达式
例:var reg.....
分类:
Web程序 时间:
2014-05-17 21:06:55
阅读次数:
335