Swap Nodes in PairsGiven a linked list, swap every two adjacent nodes and return its head.For example,Given1->2->3->4, you should return the list as2-...
分类:
其他好文 时间:
2014-11-21 18:16:43
阅读次数:
271
Given an array of integers, find two numbers such that they add up to a specific target number.The function twoSum should return indices of the two nu...
分类:
其他好文 时间:
2014-11-21 15:57:41
阅读次数:
227
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 al...
分类:
其他好文 时间:
2014-11-21 06:55:40
阅读次数:
187
ProblemPrint all valid phone numbers of length n subject to following constraints:If a number contains a 4, it should start with 4No two consecutive d...
分类:
其他好文 时间:
2014-11-21 06:54:39
阅读次数:
149
Given an integern, generate a square matrix filled with elements from 1 ton2in spiral order.For example,Givenn=3,You should return the following matri...
分类:
其他好文 时间:
2014-11-20 23:21:17
阅读次数:
256
Single Number IIGiven an array of integers, every element appearsthreetimes except for one. Find that single one.Note:Your algorithm should have a lin...
分类:
其他好文 时间:
2014-11-20 18:29:54
阅读次数:
271
Follow up for "Remove Duplicates":
What if duplicates are allowed at most twice?
For example,
Given sorted array A = [1,1,1,2,2,3],
Your function should return length = 5, and A is now [1,1,2,...
分类:
其他好文 时间:
2014-11-20 17:07:45
阅读次数:
194
题目:Given an array of integers, every element appearstwiceexcept for one. Find that single one.Note:Your algorithm should have a linear runtime complex...
分类:
其他好文 时间:
2014-11-20 14:59:10
阅读次数:
169
Design and implement a data structure for Least Recently Used (LRU) cache. It should support the following operations:getandset.get(key)- Get the valu...
分类:
系统相关 时间:
2014-11-20 13:39:25
阅读次数:
289
问题描述:
Follow up for "Remove Duplicates":
What if duplicates are allowed at most twice?
For example,
Given sorted array A = [1,1,1,2,2,3],
Your function should return length = 5, and A is now
[...
分类:
其他好文 时间:
2014-11-19 22:19:08
阅读次数:
138