码迷,mamicode.com
首页 >  
搜索关键字:merge two sorted lists    ( 21789个结果
LeetCode:Multiply Strings
题目链接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
LeetCode:Add Two Numbers
题目链接 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
Leetcode | Search in Rotated Sorted Array I & II
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
【LeetCode】Add Binary
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
Leetcode | Remove Duplicates from Sorted Array I && II
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写的归并排序的程序,然后自己跟着他写了一下,结果发现是错的,不得不自己操作。而自己对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
LeetCode: Merge k Sorted Lists [022]
【题目】 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
LeetCode: Swap Nodes in Pairs [023]
【题目】 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
[leetcode]:Two Sum
题目:给定一个数组,以及一个 target 值,target 表示目标和,要求在数组中找到两个数,xi,xj,使得 xi + xj = target。返回值是找到的两个数的下标索引,升序排序。假定至少存在一对解。 分析:对于要处理数组的问题,我们的理想状态都是给定的数组是有序的就好了,在有序后,我们就可以首位各放一个标记。类似于二分查找。 vector twoSum(vector &n...
分类:其他好文   时间:2014-05-18 08:04:03    阅读次数:234
HDU-4734-F(x)
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
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!