题目:两个链表存储数字,然后求和,和值存储在一个链表中。代码: 1 public ListNode
addTwoNumbers(ListNode l1, ListNode l2) { 2 ListNode head = new ListNode(0); 3
ListN...
分类:
其他好文 时间:
2014-06-29 15:15:57
阅读次数:
240
Given a linked list, swap every two adjacent
nodes and return its head. For example, Given 1->2->3->4, you should
return the list as 2->1->4->3. Your ...
分类:
其他好文 时间:
2014-06-29 14:39:10
阅读次数:
268
【转】:http://www.cnblogs.com/lazycoding/archive/2011/04/04/two_include.html<%@
include file=”relativeURI”%><jsp:include page=”relativeURI” flush=”true” ...
分类:
Web程序 时间:
2014-05-29 01:50:53
阅读次数:
242
题目链接说来算是个基础题目,可是还是各种CE,各种WA,基础还是不扎实。附上代码: 1 /** 2 *
Definition for singly-linked list. 3 * struct ListNode { 4 * int val; 5 *
ListNode *ne...
分类:
其他好文 时间:
2014-05-28 23:56:38
阅读次数:
382
Merge k sorted linked lists and return it as
one sorted list. Analyze and describe its complexity.
对每一个排序链表都设置一个指针。每次讲指针指向的单元中最小值链接,直到所有指针为空。 public c...
分类:
其他好文 时间:
2014-05-28 09:59:54
阅读次数:
263
Given an array of integers, find two numbers such
that they add up to a specific target number.The function twoSum should return
indices of the two nu...
分类:
其他好文 时间:
2014-05-26 19:50:39
阅读次数:
314
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 i...
分类:
其他好文 时间:
2014-05-25 21:36:52
阅读次数:
268
题目:一个有序数组,要求保证数组中的每个元素不能超过2个。 输入:A =[1,1,1,2,2,3]
输出:length =5, and A is now[1,1,2,2,3]思路:双指针
。有些绕,不过理清了后,思路还是很直接明朗的。1、两个指针:p和help。初始化时同时指向数组头。变量cur.....
分类:
其他好文 时间:
2014-05-25 16:15:16
阅读次数:
285
题目:合并两个有序数组A ,
B,将合并后的数组存到A中。假设A的空间足够装下A和B所有的元素。思路:这道题考虑如果正向扫描两个数组,则每插入一个元素,则需移动A后的所有元素。换个角度想,既然元素个数一定,则从尾部扫描两个数组,依次放入到A的尾部,这样既不会产生大量元素的移动,也不会造成A中元素被覆...
分类:
其他好文 时间:
2014-05-25 15:09:32
阅读次数:
222
1.JS include :DOM BOM ECMA2.Browser 分别独立实现dom &
JSas if two isolated islands3.JS操作DOMfrom the island to the other one4.DOM性能The
bridges between island...
分类:
其他好文 时间:
2014-05-25 11:28:12
阅读次数:
246