导航

2015年8月8日

摘要: Given a 2D binary matrix filled with 0's and 1's, find the largest square containing all 1's and return its area.For example, given the following matr... 阅读全文

posted @ 2015-08-08 14:10 骄阳照林 阅读(127) 评论(0) 推荐(0) 编辑

2015年8月7日

摘要: Given acompletebinary tree, count the number of nodes.Definition of a complete binary tree fromWikipedia:In a complete binary tree every level, except... 阅读全文

posted @ 2015-08-07 17:46 骄阳照林 阅读(170) 评论(0) 推荐(0) 编辑

摘要: Implement a basic calculator to evaluate a simple expression string.The expression string may contain open(and closing parentheses), the plus+or minus... 阅读全文

posted @ 2015-08-07 16:34 骄阳照林 阅读(144) 评论(0) 推荐(0) 编辑

摘要: Implement a basic calculator to evaluate a simple expression string.The expression string contains onlynon-negativeintegers,+,-,*,/operators and empty... 阅读全文

posted @ 2015-08-07 13:32 骄阳照林 阅读(137) 评论(0) 推荐(0) 编辑

2015年8月6日

摘要: Given an integer array of sizen, find all elements that appear more than⌊ n/3 ⌋times. The algorithm should run in linear time and in O(1) space.解法:参考编... 阅读全文

posted @ 2015-08-06 22:45 骄阳照林 阅读(134) 评论(0) 推荐(0) 编辑

2015年8月5日

摘要: Given a binary search tree, write a functionkthSmallestto find thekth smallest element in it.Note:You may assume k is always valid, 1 ≤ k ≤ BST's tota... 阅读全文

posted @ 2015-08-05 18:33 骄阳照林 阅读(148) 评论(0) 推荐(0) 编辑

2015年8月4日

摘要: Given an integer n, count the total number of digit 1 appearing in all non-negative integers less than or equal to n.For example:Given n = 13,Return 6... 阅读全文

posted @ 2015-08-04 20:13 骄阳照林 阅读(109) 评论(0) 推荐(0) 编辑

摘要: Given a binary tree, find the lowest common ancestor (LCA) of two given nodes in the tree.According to thedefinition of LCA on Wikipedia: “The lowest ... 阅读全文

posted @ 2015-08-04 19:14 骄阳照林 阅读(123) 评论(0) 推荐(0) 编辑

摘要: Given an array ofnintegers wheren> 1,nums, return an arrayoutputsuch thatoutput[i]is equal to the product of all the elements ofnumsexceptnums[i].Solv... 阅读全文

posted @ 2015-08-04 18:49 骄阳照林 阅读(169) 评论(0) 推荐(0) 编辑

摘要: Write an efficient algorithm that searches for a value in anmxnmatrix. This matrix has the following properties:Integers in each row are sorted in asc... 阅读全文

posted @ 2015-08-04 17:49 骄阳照林 阅读(104) 评论(0) 推荐(0) 编辑