码迷,mamicode.com
首页 >  
搜索关键字:sorted list ii    ( 64619个结果
Leetcode 线性表 Remove Duplicates from Sorted List II
题意:将已排序的链表中所有重复的元素移除 思路: 三个个指针,pre, cur, next 一个布尔变量is_appear,表示cur指针指向的值之前是否已经出现过 检查cur, next指向的节点的值是否相同, 相同的话,删除cur 不同的话,如果is_appear为true,删除cur,否则不删除 删除的话,只移动cur, next指针 不删除的话,要移动pre, cur, next三个指针 复杂度:时间O(n),空间O(1)...
分类:其他好文   时间:2014-05-15 02:54:32    阅读次数:262
Leetcode 线性表 Remove Nth Node From End of List
题意:移除链表的倒数第n个元素 思路: 两个指针p, q, p先走n步,然后p,q一起走,当p走到尾的时候,q->next就是要删除的节点 复杂度: 时间O(n),空间O(1)...
分类:其他好文   时间:2014-05-15 02:53:13    阅读次数:241
asp.net设置默认打开页面,Web.config,defaultDocument
The web.config file can be used to set a default document, or list of default documents for your website. Web.config can be used to change the defau.....
分类:Web程序   时间:2014-05-15 02:21:15    阅读次数:448
LeetCode--Single Number II
Single Number II  Total Accepted: 14472 Total Submissions: 44420My Submissions Given an array of integers, every element appears three times except for one. Find that single one. Note: Y...
分类:其他好文   时间:2014-05-15 01:23:42    阅读次数:273
LeetCode--Linked List Cycle
Linked List Cycle  Total Accepted: 17148 Total Submissions: 49300My Submissions Given a linked list, determine if it has a cycle in it. Follow up: Can you solve it without using extra sp...
分类:其他好文   时间:2014-05-15 00:13:50    阅读次数:279
【LeetCode】Linked List Cycle
Linked List CycleGiven a linked list, determine if it has a cycle in it.Follow up:Can you solve it without using extra space?做完Linked List Cycle II在做这...
分类:其他好文   时间:2014-05-14 23:30:00    阅读次数:399
python经典算法
# 非波拉锲数列def fibs(num): the_list=[] a,b,i=0,1,1 for i in range(num-1): a,b=b,a+b print bfibs(10)
分类:编程语言   时间:2014-05-14 22:00:27    阅读次数:290
c语言之struct
1. 结构的基础知识 跟数组一样是成员的集合,但与数组有很大的区别,结构的元素不能通过下标法来访问,因为各个成员的大小可能不同,但是数组可以,因为数组元素保持一致。 1.1 结构声明 struct  tag {member-list } variable-list ; 上面黑色部分是可选部分,但是必须同时出现两个。 实例一:下面是实例: struct{ i...
分类:编程语言   时间:2014-05-14 21:47:06    阅读次数:522
Leetcode 线性表 Remove Duplicates from Sorted Array II
题意:从一个已排序的数组中移除掉重复的元素,每个元素最多可重复两次 思路: 思路和Remove Duplicates from Sorted Array一样,不过要设置一个计数变量,表示当前值出现的次数 出现次数少于2可以加入到新数组,多于2则不可以。每次遇到一个新变量要把计数变量重新设置为1,加入新数组要加1 复杂度:时间O(n), 空间O(1)...
分类:其他好文   时间:2014-05-14 21:03:00    阅读次数:262
JDBC连接数据库返回结果集的Key值
JDBC连接数据库查询数据时时返回ResultSet结果集。ResultSet中存放键值对。我们可以首先取得Key值,然后通过key值获取我们想要的value。那么我们如何获取Key值呢?看下面代码:try{ List<Map<String,String>>list=newArrayList<Map<String,String>>();..
分类:数据库   时间:2014-05-14 19:07:01    阅读次数:1107
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!