随笔分类 -  algorithm

摘要:Unique Paths IITotal Accepted:31019Total Submissions:110866My SubmissionsQuestionSolutionFollow up for "Unique Paths":Now consider if some obstacles a... 阅读全文

posted @ 2015-04-08 03:04 Yu's Garden 阅读(627) 评论(0) 推荐(0)

摘要:A robot is located at the top-left corner of amxngrid (marked 'Start' in the diagram below).The robot can only move either down or right at any point ... 阅读全文

posted @ 2015-04-08 02:38 Yu's Garden 阅读(780) 评论(0) 推荐(0)

摘要:Remove Nth Node From End of ListTotal Accepted:46720Total Submissions:168596My SubmissionsQuestionSolutionGiven a linked list, remove thenthnode from ... 阅读全文

posted @ 2015-04-04 15:25 Yu's Garden 阅读(855) 评论(0) 推荐(0)

摘要:Convert Sorted List to Binary Search TreeGiven a singly linked list where elements are sorted in ascending order, convert it to a height balanced BST.... 阅读全文

posted @ 2015-04-04 13:48 Yu's Garden 阅读(1689) 评论(0) 推荐(0)

摘要:Google面试题股市上一个股票的价格从开市开始是不停的变化的,需要开发一个系统,给定一个股票,它能实时显示从开市到当前时间的这个股票的价格的中位数(中值)。SOLUTION 1:1.维持两个heap,一个是最小堆,一个是最大堆。2.一直使maxHeap的size大于minHeap.3. 当两边si... 阅读全文

posted @ 2015-01-23 08:12 Yu's Garden 阅读(4245) 评论(0) 推荐(0)

摘要:Find first K frequency numbers/** Input: int[] A = {1, 1, 2, 3, 4, 5, 2}; k = 3* return the highest frequency numbers.* return: [1, 2, 3] or [1, 2, 4]... 阅读全文

posted @ 2014-12-13 00:07 Yu's Garden 阅读(479) 评论(0) 推荐(0)

摘要:Iterative vs. Recursive ApproachesEyal Lantzman, 5 Nov 2007 CPOLIntroductionThis article was originally posted at blogs.microsoft.co.il/blogs/Eyal.Re... 阅读全文

posted @ 2014-10-22 18:22 Yu's Garden 阅读(917) 评论(0) 推荐(0)

导航