题目链接Given two numbers represented as strings,
return multiplication of the numbers as a string.Note: The numbers can be
arbitrarily large and are non-...
分类:
其他好文 时间:
2014-05-19 14:10:25
阅读次数:
250
题目链接 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 si...
分类:
其他好文 时间:
2014-05-19 13:53:32
阅读次数:
296
Search in Rotated Sorted Array ISuppose a
sorted array is rotated at some pivot unknown to you beforehand.(i.e., 0 1 2 4 5
6 7 might become 4 5 6 7 0 ...
分类:
其他好文 时间:
2014-05-19 12:30:00
阅读次数:
388
Given two binary strings, return their sum
(also a binary string).For example,a ="11"b ="1"Return"100".public class
Solution { public String addBin...
分类:
其他好文 时间:
2014-05-19 12:15:49
阅读次数:
220
Remove Duplicates from Sorted Array IGiven a
sorted array, remove the duplicates in place such that each element appear only
once and return the new l...
分类:
其他好文 时间:
2014-05-19 12:10:41
阅读次数:
329
本来在博客上看到用python写的归并排序的程序,然后自己跟着他写了一下,结果发现是错的,不得不自己操作。而自己对python不是很了解所以就变百度边写,终于在花了半个小时之后就写好了。
def merge(a, first, end, temp):
if first < end:
mid = (first+end)//2
merge(a, first, mid, temp) #前半部...
分类:
编程语言 时间:
2014-05-18 09:16:53
阅读次数:
296
【题目】
Merge k sorted linked lists and return it as one sorted list. Analyze and describe its complexity.
【题意】
合并K个有序链表
【思路】
归并
Given n pairs of parentheses, write a function to generate all combinations of well-formed parentheses.
For ...
分类:
其他好文 时间:
2014-05-18 09:05:40
阅读次数:
255
【题目】
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 algorithm should use only constant space. You may not modify the values in the list, only nodes it...
分类:
其他好文 时间:
2014-05-18 08:37:57
阅读次数:
370
题目:给定一个数组,以及一个 target 值,target 表示目标和,要求在数组中找到两个数,xi,xj,使得 xi + xj = target。返回值是找到的两个数的下标索引,升序排序。假定至少存在一对解。
分析:对于要处理数组的问题,我们的理想状态都是给定的数组是有序的就好了,在有序后,我们就可以首位各放一个标记。类似于二分查找。
vector twoSum(vector &n...
分类:
其他好文 时间:
2014-05-18 08:04:03
阅读次数:
234
Problem Description
For a decimal number x with n digits (AnAn-1An-2 ... A2A1), we define its weight as F(x) = An * 2n-1 + An-1 * 2n-2 + ... + A2 * 2 + A1 *
1. Now you are given two numbers A and...
分类:
其他好文 时间:
2014-05-18 06:35:50
阅读次数:
300