11 2014 档案

摘要:唯一路径问题II Unique Paths II Follow up for "Unique Paths": Now consider if some obstacles are added to the grids. How many unique paths would there be? An 阅读全文
posted @ 2014-11-25 18:10 ScottGu 阅读(253) 评论(0) 推荐(0)
摘要:如何在JAVA中实现一个固定最大size的hashMap利用LinkedHashMap的removeEldestEntry方法,重载此方法使得这个map可以增长到最大size,之后每插入一条新的记录就会删除一条最老的记录。import java.util.LinkedHashMap;import j... 阅读全文
posted @ 2014-11-24 13:00 ScottGu 阅读(1523) 评论(0) 推荐(0)
摘要:Populating Next Right Pointers in Each NodeGiven a binary tree struct TreeLinkNode { TreeLinkNode *left; TreeLinkNode *right; TreeLi... 阅读全文
posted @ 2014-11-20 00:36 ScottGu 阅读(180) 评论(0) 推荐(0)
摘要:Binary Tree Preorder Traversal Binary Tree Preorder Traversal Given a binary tree, return the preorder traversal of its nodes' values. For example:Giv 阅读全文
posted @ 2014-11-19 14:39 ScottGu 阅读(259) 评论(0) 推荐(0)
摘要:Linked List Cycle Given a linked list, determine if it has a cycle in it. Follow up:Can you solve it without using extra space? # Definition for singl 阅读全文
posted @ 2014-11-18 17:32 ScottGu 阅读(408) 评论(0) 推荐(0)
摘要:Given n, how many structurally unique BST's (binary search trees) that store values 1...n? For example,Given n = 3, there are a total of 5 unique BST' 阅读全文
posted @ 2014-11-18 13:37 ScottGu 阅读(304) 评论(0) 推荐(0)
摘要:Pivot 随机选取意义不大第一种方法使用随机pivot,使得尽可能平均二分序列,而实际上一般来说需要排序的集合往往是乱序的,无需重新生成随机数作为pivot,大可使用固定位置的数作为pivot,这样便可以适应绝大多数情况,并且简化了逻辑,便有了第二种simple quick Sort。从运算结果来... 阅读全文
posted @ 2014-11-17 16:54 ScottGu 阅读(506) 评论(0) 推荐(0)
摘要:先看一道leetcode题: Best Time to Buy and Sell Stock II Say you have an array for which the ith element is the price of a given stock on day i. Design an al 阅读全文
posted @ 2014-11-15 00:00 ScottGu 阅读(1208) 评论(0) 推荐(0)