随笔分类 -  leetcode

摘要:标题:Unique Paths通过率:32.6% 难度:中等A robot is located at the top-left corner of amxngrid (marked 'Start' in the diagram below).The robot can only move e... 阅读全文
posted @ 2015-03-05 11:32 pku_smile 阅读(131) 评论(0) 推荐(0)
摘要:标题:Binary Tree Postorder Traversal通过率:31.8%难度:难Given a binary tree, return thepostordertraversal of its nodes' values.For example:Given binary tree{1,... 阅读全文
posted @ 2015-03-03 16:54 pku_smile 阅读(102) 评论(0) 推荐(0)
摘要:标题:Binary Tree Inorder Traversal通过率:36.1%难度:中等Given a binary tree, return theinordertraversal of its nodes' values.For example:Given binary tree{1,#,2... 阅读全文
posted @ 2015-03-03 16:52 pku_smile 阅读(114) 评论(0) 推荐(0)
摘要:标题:Binary Tree Preorder Traversal通过率:36.2%难度:中等Given a binary tree, return thepreordertraversal of its nodes' values.For example:Given binary tree{1,#... 阅读全文
posted @ 2015-03-03 16:42 pku_smile 阅读(137) 评论(0) 推荐(0)
摘要:标题:Rotate Array通过率:18.4%难度:简单Rotate an array ofnelements to the right byksteps.For example, withn= 7 andk= 3, the array[1,2,3,4,5,6,7]is rotated to[5,... 阅读全文
posted @ 2015-03-03 16:33 pku_smile 阅读(190) 评论(0) 推荐(0)
摘要:标题Validate Binary Search Tree通过率21.9%难度中等Given a binary tree, determine if it is a valid binary search tree (BST).Assume a BST is defined as follows:T... 阅读全文
posted @ 2015-02-25 11:46 pku_smile 阅读(140) 评论(0) 推荐(0)
摘要:标题:Unique Binary Search Trees II通过率:27.5%难度:中等Givenn, generate all structurally uniqueBST's(binary search trees) that store values 1...n.For example,G... 阅读全文
posted @ 2015-02-20 13:51 pku_smile 阅读(147) 评论(0) 推荐(0)
摘要:标题:Unique Binary Search Trees通过率:37.0%难度:中等Givenn, how many structurally uniqueBST's(binary search trees) that store values 1...n?For example,Givenn= ... 阅读全文
posted @ 2015-02-20 13:49 pku_smile 阅读(168) 评论(0) 推荐(0)
摘要:标题:Sort List通过率:21.3%难度:中等Sort a linked list inO(nlogn) time using constant space complexity.本题就是一个排序的问题,但是是针对单向链表去处理,那么问题关键就是怎么去处理链表,时间复杂度为nlogn,所以可以... 阅读全文
posted @ 2015-02-16 11:06 pku_smile 阅读(157) 评论(0) 推荐(0)
摘要:标题:Find Minimum in Rotated Sorted Array II通过率:31.1%难度:难Follow upfor "Find Minimum in Rotated Sorted Array":What ifduplicatesare allowed?Would this aff... 阅读全文
posted @ 2015-02-15 11:10 pku_smile 阅读(169) 评论(0) 推荐(0)
摘要:标题:Find Minimum in Rotated Sorted Array通过率:32.8%难度:中等Suppose a sorted array is rotated at some pivot unknown to you beforehand.(i.e.,0 1 2 4 5 6 7migh... 阅读全文
posted @ 2015-02-15 11:07 pku_smile 阅读(158) 评论(0) 推荐(0)
摘要:标题:Maximum Subarray通过率:34.5%难度:中等Find the contiguous subarray within an array (containing at least one number) which has the largest sum.For example, ... 阅读全文
posted @ 2015-02-13 11:25 pku_smile 阅读(166) 评论(0) 推荐(0)
摘要:题目:Search Insert Position通过率:35.3%难度:中等Given a sorted array and a target value, return the index if the target is found. If not, return the index wher... 阅读全文
posted @ 2015-02-12 11:37 pku_smile 阅读(185) 评论(0) 推荐(0)
摘要:题目Search in Rotated Sorted ArrayII通过率:31.4%难度:中等Follow up for "Search in Rotated Sorted Array":What ifduplicatesare allowed?Would this affect the run-... 阅读全文
posted @ 2015-02-12 11:30 pku_smile 阅读(169) 评论(0) 推荐(0)
摘要:标题:Search in Rotated Sorted Array通过率:28.9%难度:难Suppose a sorted array is rotated at some pivot unknown to you beforehand.(i.e.,0 1 2 4 5 6 7might becom... 阅读全文
posted @ 2015-02-12 11:27 pku_smile 阅读(146) 评论(0) 推荐(0)
摘要:标题:Multiply Strings通过率: 20.8%难度:中等Given two numbers represented as strings, return multiplication of the numbers as a string.Note: The numbers can be ... 阅读全文
posted @ 2015-02-11 14:46 pku_smile 阅读(212) 评论(0) 推荐(0)
摘要:标题:Integer to Roman通过率:34.4%难度:中等Given an integer, convert it to a roman numeral.Input is guaranteed to be within the range from 1 to 3999.前面做过数字转罗马数字... 阅读全文
posted @ 2015-02-11 14:38 pku_smile 阅读(214) 评论(0) 推荐(0)
摘要:标题:Find Peak Element通过率:32.3%难度:中等A peak element is an element that is greater than its neighbors.Given an input array wherenum[i] ≠ num[i+1], find a ... 阅读全文
posted @ 2015-02-10 11:33 pku_smile 阅读(251) 评论(0) 推荐(0)
摘要:标题:Search a 2D Matrix通过率31.3%难度中等Write an efficient algorithm that searches for a value in anmxnmatrix. This matrix has the following properties:Integ... 阅读全文
posted @ 2015-02-10 11:20 pku_smile 阅读(205) 评论(0) 推荐(0)
摘要:标题:Set Matrix Zeroes通过率:31.3%难度:中等Given amxnmatrix, if an element is 0, set its entire row and column to 0. Do it in place.click to show follow up.Fol... 阅读全文
posted @ 2015-02-09 11:19 pku_smile 阅读(182) 评论(0) 推荐(0)