随笔分类 -  leetcode

摘要:Question Write an efficient algorithm that searches for a value in an m x n matrix. This matrix has the following properties: Integers in each row are 阅读全文
posted @ 2017-09-17 11:45 清水汪汪 阅读(247) 评论(0) 推荐(0)
摘要:Question Given an integer array, find three numbers whose product is maximum and output the maximum product. Example 1: Example 2: Note: The length of 阅读全文
posted @ 2017-09-17 11:16 清水汪汪 阅读(136) 评论(0) 推荐(0)
摘要:Question You need to find the largest value in each row of a binary tree. Example: Solution 层次遍历。 Code 阅读全文
posted @ 2017-09-15 13:49 清水汪汪 阅读(188) 评论(0) 推荐(0)
摘要:Question Given a sorted array consisting of only integers where every element appears twice except for one element which appears once. Find this singl 阅读全文
posted @ 2017-09-15 11:53 清水汪汪 阅读(200) 评论(0) 推荐(0)
摘要:Question Given an array of integers, 1 ≤ a[i] ≤ n (n = size of array), some elements appear twice and others appear once. Find all the elements that a 阅读全文
posted @ 2017-09-15 10:14 清水汪汪 阅读(151) 评论(0) 推荐(0)
摘要:Question Given a binary tree, find the leftmost value in the last row of the tree. Example 1: Input: Output: 1 Example 2: Input: Output: 7 Note: You m 阅读全文
posted @ 2017-09-14 22:40 清水汪汪 阅读(235) 评论(0) 推荐(0)
摘要:Question Given an integer array with no duplicates. A maximum tree building on this array is defined as follow: The root is the maximum number in the 阅读全文
posted @ 2017-09-14 20:14 清水汪汪 阅读(168) 评论(0) 推荐(0)
摘要:Question Given a non empty array containing only positive integers, find if the array can be partitioned into two subsets such that the sum of element 阅读全文
posted @ 2017-09-13 19:30 清水汪汪 阅读(185) 评论(0) 推荐(0)
摘要:Question Given an integer n, generate all structurally unique BST's (binary search trees) that store values 1...n. For example, Given n = 3, your prog 阅读全文
posted @ 2017-09-13 16:08 清水汪汪 阅读(128) 评论(0) 推荐(0)
摘要:Question Given a string s and a string t, check if s is subsequence of t. You may assume that there is only lower case English letters in both s and t 阅读全文
posted @ 2017-09-13 14:24 清水汪汪 阅读(146) 评论(0) 推荐(0)
摘要:Question 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 u 阅读全文
posted @ 2017-09-13 14:19 清水汪汪 阅读(141) 评论(0) 推荐(0)
摘要:Question A robot is located at the top left corner of a m x n grid (marked 'Start' in the diagram below). The robot can only move either down or right 阅读全文
posted @ 2017-09-12 23:30 清水汪汪 阅读(133) 评论(0) 推荐(0)
摘要:Question Given a non negative integer number num. For every numbers i in the range 0 ≤ i ≤ num calculate the number of 1's in their binary representat 阅读全文
posted @ 2017-09-10 18:41 清水汪汪 阅读(117) 评论(0) 推荐(0)
摘要:Question Given a string, your task is to count how many palindromic substrings in this string. The substrings with different start indexes or end inde 阅读全文
posted @ 2017-09-10 13:19 清水汪汪 阅读(162) 评论(0) 推荐(0)
摘要:Question Given a positive integer n, break it into the sum of at least two positive integers and maximize the product of those integers. Return the ma 阅读全文
posted @ 2017-09-10 11:43 清水汪汪 阅读(135) 评论(0) 推荐(0)
摘要:Question A sequence of number is called arithmetic if it consists of at least three elements and if the difference between any two consecutive element 阅读全文
posted @ 2017-09-10 11:08 清水汪汪 阅读(145) 评论(0) 推荐(0)
摘要:Question Given an integer array nums, find the sum of the elements between indices i and j (i ≤ j), inclusive. Example: Given nums = [ 2, 0, 3, 5, 2, 阅读全文
posted @ 2017-09-10 10:27 清水汪汪 阅读(128) 评论(0) 推荐(0)
摘要:Question Given a string s and a dictionary of words dict, determine if s can be segmented into a space separated sequence of one or more dictionary wo 阅读全文
posted @ 2017-07-06 15:14 清水汪汪 阅读(128) 评论(0) 推荐(0)
摘要:Question Given inorder and postorder traversal of a tree, construct the binary tree. Note: You may assume that duplicates do not exist in the tree. So 阅读全文
posted @ 2017-06-29 20:56 清水汪汪 阅读(161) 评论(0) 推荐(0)
摘要:Question Given preorder and inorder traversal of a tree, construct the binary tree. Note: You may assume that duplicates do not exist in the tree. Sol 阅读全文
posted @ 2017-06-29 20:53 清水汪汪 阅读(171) 评论(0) 推荐(0)