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 first two lists.代码:class ...
分类:
其他好文 时间:
2014-11-19 21:47:39
阅读次数:
119
Given a linked list and a valuex, partition it such that all nodes less thanxcome before nodes greater than or equal tox.You should preserve the origi...
分类:
其他好文 时间:
2014-11-19 20:32:41
阅读次数:
129
LRU CacheDesign and implement a data structure for Least Recently Used (LRU) cache. It should support the following operations:getandset.get(key)- Get...
分类:
系统相关 时间:
2014-11-19 20:29:44
阅读次数:
289
Given an integer n, generate a square matrix filled with elements from 1 to n2 in spiral order.
For example,
Given n = 3,
You should return the following matrix:
[
[ 1, 2, 3 ],
[ 8, 9, 4 ],
[...
分类:
其他好文 时间:
2014-11-19 16:05:08
阅读次数:
143
Given a linked list, swap every two adjacent nodes and return its head.For example,Given1->2->3->4, you should return the list as2->1->4->3.Your algor...
分类:
其他好文 时间:
2014-11-19 15:41:29
阅读次数:
165
Follow up for "Remove Duplicates":What if duplicates are allowed at mosttwice?For example,Given sorted array A =[1,1,1,2,2,3],Your function should ret...
分类:
其他好文 时间:
2014-11-19 14:01:24
阅读次数:
134
一道LeetCode OJ上的题目,要求设计一个LRU(Least Recently Used)算法,题目描述如下:Design and implement a data structure for Least Recently Used (LRU) cache. It should support...
分类:
编程语言 时间:
2014-11-19 13:51:25
阅读次数:
222
Given a linked list, swap every two adjacent nodes and return its head.For example,Given1->2->3->4, you should return the list as2->1->4->3.Your algor...
分类:
其他好文 时间:
2014-11-19 00:15:33
阅读次数:
284
Given a linked list and a valuex, partition it such that all nodes less thanxcome before nodes greater than or equal tox.You should preserve the origi...
分类:
其他好文 时间:
2014-11-18 23:45:02
阅读次数:
222
Given an array of integers, every element appearsthreetimes except for one. Find that single one.Note:Your algorithm should have a linear runtime comp...
分类:
其他好文 时间:
2014-11-18 23:22:33
阅读次数:
206