You are given two linked lists representing two non-negative numbers. The digits are stored in reverse order and each of their nodes contain a single digit. Add the two numbers and return it as a link...
分类:
其他好文 时间:
2014-05-23 07:43:23
阅读次数:
246
【题目】
Given a sorted array and a target value, return the index if the target is found. If not, return the index where it would be if it were inserted in order.
You may assume no duplicates in the array.
Here are few examples.
[1,3,5,6], 5 → 2
[1,3,5,6]...
分类:
其他好文 时间:
2014-05-22 09:41:59
阅读次数:
195
找出单词的最长公共前缀
class Solution {
public:
string longestCommonPrefix(vector &strs) {
int len=strs.size();
if(len==0)
return "";
int length=strs[0].size(),j;
...
分类:
其他好文 时间:
2014-05-22 09:35:20
阅读次数:
230
【题目】
Given a sorted array of integers, find the starting and ending position of a given target value.
Your algorithm's runtime complexity must be in the order of O(log n).
If the target is not found in the array, return [-1, -1].
For example,
Given [5...
分类:
其他好文 时间:
2014-05-22 06:44:39
阅读次数:
265
return 和 exit 的区别
exit() 表示结束当前进程或当前程序,在整个程序中,只要有
exit,就退出,并将应用程序的一个状态返回给OS。一般
和操作系统相关的是0为正常退出,非0为非正常退出。
return: 表示调用堆栈的返回。例如当程序进入函数调用时,当函数
...
分类:
其他好文 时间:
2014-05-22 06:22:02
阅读次数:
258
表单验证
function check_1(param){//不为空
if(param==""||param==null){return false;}else{return true;}
}
function check_2(param){//长度限制,字母是10个,汉字也是10个
if(param.length>10){return false;}else...
分类:
Web程序 时间:
2014-05-20 17:15:45
阅读次数:
414
window["MzBrowser"]={};(function()
{
if(MzBrowser.platform) return;
var ua = window.navigator.userAgent;
MzBrowser.platform = window.navigator.platform;
MzBrowser.firefox = ua.indexOf("Firefox")>0;
Mz...
分类:
编程语言 时间:
2014-05-20 14:38:05
阅读次数:
239
戳我去解题Given two binary strings, return their sum
(also a binary string).For example,a ="11"b
="1"Return"100".分析:高精度加法,只是将10进制的高精度加法 换成了 2进制的高精度加法首先将 两个...
分类:
其他好文 时间:
2014-05-20 11:21:52
阅读次数:
224
戳我去解题Merge two sorted linked lists and return it as
a new list. The new list should be made by splicing together the nodes of the
first two lists.分析:直...
分类:
其他好文 时间:
2014-05-20 08:52:09
阅读次数:
277
戳我去解题Given a linked list, remove thenthnode from
the end of list and return its head.For example, Given linked list:
1->2->3->4->5, and n = 2. Aft...
分类:
其他好文 时间:
2014-05-20 08:04:28
阅读次数:
291