依然是链表的简单操作,把两个链表按大小顺序和成一个链表,但是还是要注意细节。下面是效率不高但是简单易懂的一种解法。需要注意两个链表都为空的情况。/** * Definition for singly-linked list. * public class ListNode { * int ...
分类:
其他好文 时间:
2015-04-03 01:30:40
阅读次数:
111
Merge Two Sorted Lists
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.
解题思路:
这道题是我做的leetcode最容易的题目了...
分类:
其他好文 时间:
2015-04-01 23:47:10
阅读次数:
173
定义:
Redis is an open source, BSD licensed, advanced key-value
cache and store.
It is often referred to as a data structure server since
keys can contain strings, hashes, lists, sets,sorted
se...
分类:
其他好文 时间:
2015-04-01 17:52:18
阅读次数:
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. 1 str...
分类:
其他好文 时间:
2015-04-01 10:49:18
阅读次数:
112
题目: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.
struct ListNode {
int val;
ListNode *next;
ListNo...
分类:
其他好文 时间:
2015-04-01 09:31:07
阅读次数:
131
题目:Write a program to find the node at which the intersection of two singly linked lists begins.
For example, the following two linked lists:
A: a1 → a2
↘
...
分类:
其他好文 时间:
2015-03-31 22:21:16
阅读次数:
116
合并有序两个链表 class Solution {public: ListNode *mergeTwoLists(ListNode *l1, ListNode *l2) { ListNode* res = new ListNode(0); if (l1 == NULL) { return l2; }...
分类:
其他好文 时间:
2015-03-31 21:50:59
阅读次数:
134
前台pc标签的使用:{pc:content 参数名="参数值" 参数名="参数值" 参数名="参数值"} 如: {pc:content action="lists" catid="9" cache="3600" num="20" page="$page"}{/pc} 执行流程如下: ①模块名:con...
分类:
Web程序 时间:
2015-03-30 22:31:30
阅读次数:
233
1 题目:2.2.1 Add Two NumbersYou 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 numbe...
分类:
其他好文 时间:
2015-03-28 08:48:00
阅读次数:
185
题目链接:intersection-of-two-linked-lists
/**
*
Write a program to find the node at which the intersection of two singly linked lists begins.
For example, the following two linked lists:
...
分类:
其他好文 时间:
2015-03-22 09:19:40
阅读次数:
151