2014年10月24日

摘要: Spiral Matrix IIGiven an integer n, generate a square matrix filled with elements from 1 to n2 in spiral order.For example,Given n = 3,You should retu... 阅读全文
posted @ 2014-10-24 11:06 Yu's Garden 阅读(921) 评论(0) 推荐(0) 编辑
摘要: Set Matrix ZeroesGiven a m x n matrix, if an element is 0, set its entire row and column to 0. Do it in place.click to show follow up.Follow up:Did yo... 阅读全文
posted @ 2014-10-24 09:44 Yu's Garden 阅读(568) 评论(0) 推荐(0) 编辑

2014年10月23日

摘要: Spiral MatrixGiven a matrix of m x n elements (m rows, n columns), return all elements of the matrix in spiral order.For example,Given the following m... 阅读全文
posted @ 2014-10-23 18:39 Yu's Garden 阅读(1750) 评论(0) 推荐(1) 编辑
摘要: Word Break IIGiven a string s and a dictionary of words dict, add spaces in s toconstruct a sentence where each word is a valid dictionaryword.Return ... 阅读全文
posted @ 2014-10-23 04:40 Yu's Garden 阅读(9663) 评论(1) 推荐(0) 编辑

2014年10月22日

摘要: Clone GraphClone an undirected graph. Each node in the graph contains a label and a list of its neighbors.OJ's undirected graph serialization:Nodes ar... 阅读全文
posted @ 2014-10-22 20:48 Yu's Garden 阅读(946) 评论(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 阅读(898) 评论(0) 推荐(0) 编辑
摘要: Maximum Product SubarrayFind the contiguous subarray within an array (containing at least one number) which has the largest product.For example, given... 阅读全文
posted @ 2014-10-22 18:06 Yu's Garden 阅读(1154) 评论(0) 推荐(1) 编辑

2014年10月21日

摘要: Populating Next Right Pointers in Each Node IIFollow up for problem "Populating Next Right Pointers in Each Node".What if the given tree could be any ... 阅读全文
posted @ 2014-10-21 19:20 Yu's Garden 阅读(2718) 评论(0) 推荐(0) 编辑
摘要: Populating Next Right Pointers in Each Node TotalGiven a binary tree struct TreeLinkNode { TreeLinkNode *left; TreeLinkNode *right; TreeLinkNode *next... 阅读全文
posted @ 2014-10-21 19:18 Yu's Garden 阅读(1974) 评论(0) 推荐(0) 编辑
摘要: Word SearchGiven a 2D board and a word, find if the word exists in the grid.The word can be constructed from letters of sequentially adjacent cell, wh... 阅读全文
posted @ 2014-10-21 15:10 Yu's Garden 阅读(3687) 评论(1) 推荐(0) 编辑

导航