Design and implement a data structure for Least Recently Used (LRU) cache. It should support the following operations: get and set.
get(key) - Get the value (will always be positive)
of the key if ...
分类:
系统相关 时间:
2014-10-22 12:56:02
阅读次数:
274
1.“开-闭”原则(OCP) Software entities should be open for extension, but closed for modification. 对扩展开放,对修改封闭。2.里氏代换原则(LSP) 凡是基类适用的地方,子类一定适用。3.依赖倒转原则(DIP) 要...
分类:
其他好文 时间:
2014-10-22 10:49:09
阅读次数:
221
Given an array of integers, every element appearstwiceexcept for one. Find that single one.Note:Your algorithm should have a linear runtime complexity...
分类:
编程语言 时间:
2014-10-21 22:53:06
阅读次数:
316
Givenn, generate all structurally uniqueBST's(binary search trees) that store values 1...n.For example,Givenn= 3, your program should return all 5 uni...
分类:
其他好文 时间:
2014-10-21 22:48:09
阅读次数:
266
Two Sum
Total Accepted:
37848 Total Submissions:
206006
Given an array of integers, find two numbers such that they add up to a specific target number.
The function twoSum should return ...
分类:
其他好文 时间:
2014-10-21 21:44:10
阅读次数:
267
subject { build(:user,firstname:'john',lastname:'doe')}it { should be_named 'john doe'}it{}和subject{}互为别名Gem扩展代码库 shoulda-matchers直接使用subject { Contac...
分类:
其他好文 时间:
2014-10-21 15:22:02
阅读次数:
216
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.Solution:...
分类:
其他好文 时间:
2014-10-21 02:17:26
阅读次数:
157
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-10-21 02:14:37
阅读次数:
266
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.
/**
* Definition for singly-linked list.
* publ...
分类:
其他好文 时间:
2014-10-20 21:28:05
阅读次数:
233
Problem: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.Yo...
分类:
其他好文 时间:
2014-10-20 13:15:42
阅读次数:
195