上一页 1 ··· 23 24 25 26 27 28 29 30 31 ··· 46 下一页

2015年1月31日

LRU Cache

摘要: Design and implement a data structure for Least Recently Used (LRU) cache. It should support the following operations:getandset.get(key)- Get the valu... 阅读全文

posted @ 2015-01-31 16:03 luckygxf 阅读(201) 评论(0) 推荐(0) 编辑

Java的HashMap和HashTable(转)

摘要: 来源:http://www.cnblogs.com/devinzhang/archive/2012/01/13/2321481.html1. HashMap1) hashmap的数据结构 Hashmap是一个数组和链表的结合体(在数据结构称“链表散列“),如下图示: 当我们往hashmap中pu... 阅读全文

posted @ 2015-01-31 13:55 luckygxf 阅读(858) 评论(0) 推荐(0) 编辑

2015年1月30日

Max Points on a Line

摘要: Givennpoints on a 2D plane, find the maximum number of points that lie on the same straight line. 1 import java.util.HashMap; 2 import java.util.Itera... 阅读全文

posted @ 2015-01-30 20:26 luckygxf 阅读(165) 评论(0) 推荐(0) 编辑

java 整型相除得到浮点型

摘要: 1 public class TestFloatOrDouble { 2 3 public static void main(String[] args) { 4 Point num1 = new Point(84, 250); 5 Point num2 ... 阅读全文

posted @ 2015-01-30 20:23 luckygxf 阅读(10505) 评论(0) 推荐(0) 编辑

2015年1月29日

Interleaving String

摘要: Givens1,s2,s3, find whethers3is formed by the interleaving ofs1ands2.For example,Given:s1="aabcc",s2="dbbca",Whens3="aadbbcbcac", return true.Whens3="... 阅读全文

posted @ 2015-01-29 15:29 luckygxf 阅读(186) 评论(0) 推荐(0) 编辑

2015年1月28日

Insert Interval

摘要: Given a set ofnon-overlappingintervals, insert a new interval into the intervals (merge if necessary).You may assume that the intervals were initially... 阅读全文

posted @ 2015-01-28 10:47 luckygxf 阅读(183) 评论(0) 推荐(0) 编辑

Merge Intervals

摘要: Given a collection of intervals, merge all overlapping intervals.For example,Given[1,3],[2,6],[8,10],[15,18],return[1,6],[8,10],[15,18].思路先按照Interval.... 阅读全文

posted @ 2015-01-28 09:41 luckygxf 阅读(193) 评论(0) 推荐(0) 编辑

2015年1月27日

Trapping Rain Water

摘要: Givennnon-negative integers representing an elevation map where the width of each bar is 1, compute how much water it is able to trap after raining.Fo... 阅读全文

posted @ 2015-01-27 13:59 luckygxf 阅读(131) 评论(0) 推荐(0) 编辑

2015年1月26日

Binary Tree Postorder Traversal

摘要: Given a binary tree, return thepostordertraversal of its nodes' values.For example:Given binary tree{1,#,2,3}, 1 \ 2 / 3return[3,2,1].这道... 阅读全文

posted @ 2015-01-26 16:09 luckygxf 阅读(145) 评论(0) 推荐(0) 编辑

2015年1月25日

Longest Consecutive Sequence

摘要: Given an unsorted array of integers, find the length of the longest consecutive elements sequence.For example,Given[100, 4, 200, 1, 3, 2],The longest ... 阅读全文

posted @ 2015-01-25 15:54 luckygxf 阅读(167) 评论(0) 推荐(0) 编辑

上一页 1 ··· 23 24 25 26 27 28 29 30 31 ··· 46 下一页

导航