码迷,mamicode.com
首页 >  
搜索关键字:merge k sorted lists    ( 11722个结果
【LeetCode】- Search Insert Position(查找插入的位置)
[ 问题: ] Given a sorted array and a target value, return the index if the target is found. If not, return the index where it would be if it were inserted in order. You may assume no duplicates in th...
分类:其他好文   时间:2014-07-22 23:01:15    阅读次数:270
Leetcode | Merge k Sorted Lists
Mergeksorted linked lists and return it as one sorted list. Analyze and describe its complexity.想法很简单,就是两两合并。在Merge Two Sorted Lists这道题已经实现了两两合并的代码了,就...
分类:其他好文   时间:2014-05-06 00:22:01    阅读次数:337
LeetCode---Merge Intervals
题目链接区间合并,贪心,需要注意边界情况,LeetCode的数据还是比较好的,这样才能写出健壮的程序。附上代码: 1 /** 2 * Definition for an interval. 3 * struct Interval { 4 * int start; 5 * in...
分类:其他好文   时间:2014-05-06 00:16:44    阅读次数:400
Leetcode: Remove Duplicates from Sorted List
遇到的问题:input{1,1,1}, output{1,1}, expected{1}, 原因在于若temp.val==temp.next.val, 则需要temp.next=temp.next.next, 这时候就不要temp=temp.next了注意停止条件不光是temp!=null,还应该有...
分类:其他好文   时间:2014-05-05 22:47:08    阅读次数:454
Leetcode: Remove Elements
一次性通过的,比较顺利,从读题到编写到检查到通过,14分50秒,我在不断进步中,相信经过一段时间联系,这种题可以一眼就写出来,不超过5分钟。这道题应该说方法跟 Remove Duplicates from sorted Array挺类似的My Solution: 1 public class Sol...
分类:其他好文   时间:2014-05-02 12:56:10    阅读次数:260
leetcode: Search a 2D Matrix
Write an efficient algorithm that searches for a value in anmxnmatrix. This matrix has the following properties:Integers in each row are sorted from l...
分类:其他好文   时间:2014-05-02 10:41:53    阅读次数:267
leetcode: Search Insert Position
Given a sorted array and a target value, return the index if the target is found. If not, return the index where it would be if it were inserted in or...
分类:其他好文   时间:2014-05-02 09:54:11    阅读次数:269
Remove Duplicates from Sorted Array
没有想通为什么这个简单的问题竟然不是那么简单,太小看它了,以下是两个别人的很不错的solution:Solution1: 1 public class Solution { 2 public int removeDuplicates(int[] A) { 3 // Start...
分类:其他好文   时间:2014-05-01 20:19:26    阅读次数:384
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 single ...
分类:其他好文   时间:2014-05-01 20:18:54    阅读次数:425
SharePoint列表数据展现方法
方法1:Guid guid = new Guid ("{8238B046-EC5F-46B6-8E18-028F77EC2620}");SPSite Asite = new SPSite ("http://mosslt/");SPList list = Asite.RootWeb.Lists[gui...
分类:其他好文   时间:2014-05-01 18:38:35    阅读次数:290
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!