随笔分类 -  leetCode

algorithms
摘要:Write a program to solve a Sudoku puzzle by filling the empty cells.Empty cells are indicated by the character'.'.You may assume that there will be on... 阅读全文
posted @ 2015-12-21 14:33 ScottGu 阅读(239) 评论(0) 推荐(0)
摘要:Total Accepted:43584Total Submissions:284350Difficulty:MediumGiven a 2D board containing'X'and'O', capture all regions surrounded by'X'.A region is ca... 阅读全文
posted @ 2015-12-17 23:42 ScottGu 阅读(256) 评论(0) 推荐(0)
摘要:唯一路径问题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 阅读(270) 评论(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 阅读(187) 评论(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 阅读(267) 评论(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 阅读(424) 评论(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 阅读(309) 评论(0) 推荐(0)
摘要:Pivot 随机选取意义不大第一种方法使用随机pivot,使得尽可能平均二分序列,而实际上一般来说需要排序的集合往往是乱序的,无需重新生成随机数作为pivot,大可使用固定位置的数作为pivot,这样便可以适应绝大多数情况,并且简化了逻辑,便有了第二种simple quick Sort。从运算结果来... 阅读全文
posted @ 2014-11-17 16:54 ScottGu 阅读(519) 评论(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 阅读(1221) 评论(0) 推荐(0)