原题地址:http://oj.leetcode.com/problems/swap-nodes-in-pairs/Given a linked list, swap every two adjacent nodes and return its head.For example,Given 1->2...
分类:
编程语言 时间:
2014-09-15 06:38:18
阅读次数:
200
Problem Description
There is a special number sequence which has n+1 integers. For each number in sequence, we have two rules:
● ai ∈ [0,n]
● ai ≠ aj( i ≠ j )
For sequence a and sequence b,...
分类:
其他好文 时间:
2014-09-15 01:06:27
阅读次数:
175
/* * ===================================================================================== * * Filename: min_two_selector.cpp * * Descriptio...
分类:
其他好文 时间:
2014-09-15 01:03:38
阅读次数:
190
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 fi...
分类:
编程语言 时间:
2014-09-15 01:02:17
阅读次数:
269
Problem Description
Here is a game for two players. The rule of the game is described below:
● In the beginning of the game, there are a lot of piles of beads.
● Players take turns to play. E...
分类:
其他好文 时间:
2014-09-14 23:42:04
阅读次数:
231
Problem Description
There is a special number sequence which has n+1 integers. For each number in sequence, we have two rules:
● ai ∈ [0,n]
● ai ≠ aj( i ≠ j )
For sequence a and sequence b, t...
分类:
其他好文 时间:
2014-09-14 23:41:28
阅读次数:
262
原题地址:https://oj.leetcode.com/problems/add-two-numbers/题意:You are given two linked lists representing two non-negative numbers. The digits are stored i...
分类:
编程语言 时间:
2014-09-14 23:17:17
阅读次数:
292
AddType requires at least two arguments, a mime type followed by one or more file extensions
LoadModule takes two arguments, a module name and the na...
分类:
Web程序 时间:
2014-09-14 22:00:57
阅读次数:
404
二进制字符创相加,通过进位的方式逐位考虑。也可以把相加的过程抽象成一个函数。
Given two binary strings, return their sum (also a binary string).
For example,
a = "11"
b = "1"
Return "100".
方法一:
class Solution {
public:
s...
分类:
其他好文 时间:
2014-09-14 15:26:07
阅读次数:
285
设两个数组分别为A和B,size为as和bs。原问题可以转化为两个排序数组求第k大的问题。
还是两种思路:
比较A[as/2]和B[bs/2],每次抛弃A或者B的一半
代码如下:
double findMedianSortedArrays(int A[], int m, int B[], int n) {
int total = m + n;
if (tot...
分类:
其他好文 时间:
2014-09-14 12:53:37
阅读次数:
170