摘要:Find the contiguous subarray within an array (containing at least one number) which has the largest product. For example, given the array , the contig
阅读全文
随笔分类 - Leetcode
摘要:Find all possible combinations of k numbers that add up to a number n, given that only numbers from 1 to 9 can be used and each combination should be
阅读全文
摘要:Given two integers n and k, return all possible combinations of k numbers out of 1 ... n. For example, If n = 4 and k = 2, a solution is: 做了好几个这种题了,就是
阅读全文
摘要:Given a collection of numbers that might contain duplicates, return all possible unique permutations. For example, have the following unique permutati
阅读全文
摘要:Given a collection of distinct numbers, return all possible permutations. For example, [1,2,3] have the following permutations: 做了几个 backtrack 类的题目了,
阅读全文
摘要:Given a collection of candidate numbers (C) and a target number (T), find all unique combinations in C where the candidate numbers sums to T. Each num
阅读全文
摘要:Given a set of candidate numbers (C) ( without duplicates ) and a target number (T), find all unique combinations in C where the candidate numbers sum
阅读全文
摘要:Implement next permutation, which rearranges numbers into the lexicographically next greater permutation of numbers. If such arrangement is not possib
阅读全文
摘要:Given a string s consists of upper/lower case alphabets and empty space characters , return the length of last word in the string. If the last word do
阅读全文
摘要:知道啥是 gray code 就是收获了. 下面介绍了 gray code 发明的 motivation, 了解动机后就知道啥是 gray code 了. https://zh.wikipedia.org/wiki/格雷码
阅读全文
摘要:Given an array with n objects colored red, white or blue, sort them so that objects of the same color are adjacent, with the colors in the order red,
阅读全文
摘要:Given a collection of integers that might contain duplicates, nums , return all possible subsets. Note: The solution set must not contain duplicate su
阅读全文
摘要:Given a set of distinct integers, nums, return all possible subsets. Note: The solution set must not contain duplicate subsets. For example, If , a so
阅读全文
摘要:Given two words word1 and word2, find the minimum number of steps required to convert word1 to word2. (each operation is counted as 1 step .) You have
阅读全文
摘要:Given an m x n grid filled with nonnegative numbers, find a path from top left to bottom right which minimizes the sum of all numbers along its path.
阅读全文
摘要:You are climbing a stair case. It takes n steps to reach to the top. Each time you can either climb 1 or 2 steps. In how many distinct ways can you cl
阅读全文
摘要:Follow up for "Unique Paths": Now consider if some obstacles are added to the grids. How many unique paths would there be? An obstacle and empty space
阅读全文
摘要: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 at any p
阅读全文
摘要:Given a triangle, find the minimum path sum from top to bottom. Each step you may move to adjacent numbers on the row below. For example, given the fo
阅读全文
摘要:Given an unsorted array of integers, find the length of the longest consecutive elements sequence. For example, Given , The longest consecutive elemen
阅读全文

浙公网安备 33010602011771号