随笔分类 - 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
阅读全文
摘要: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
阅读全文
摘要:Question You need to find the largest value in each row of a binary tree. Example: Solution 层次遍历。 Code
阅读全文
摘要:Question Given a sorted array consisting of only integers where every element appears twice except for one element which appears once. Find this singl
阅读全文
摘要: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
阅读全文
摘要: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
阅读全文
摘要: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
阅读全文
摘要: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
阅读全文
摘要: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
阅读全文
摘要: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
阅读全文
摘要: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
阅读全文
摘要: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
阅读全文
摘要: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
阅读全文
摘要: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
阅读全文
摘要: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
阅读全文
摘要: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
阅读全文
摘要: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,
阅读全文
摘要: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
阅读全文
摘要: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
阅读全文
摘要: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
阅读全文

浙公网安备 33010602011771号