摘要:Given two words word1 and word2, find the minimum number of operations required to convert word1 to word2. You have the following 3 operations permitt
阅读全文
摘要:Implement int sqrt(int x). Compute and return the square root of x, where x is guaranteed to be a non-negative integer. Since the return type is an in
阅读全文
摘要:Given an array of words and a width maxWidth, format the text such that each line has exactly maxWidth characters and is fully (left and right) justif
阅读全文
摘要: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
阅读全文
摘要:The set [1,2,3,...,n] contains a total of n! unique permutations. By listing and labeling all of the permutations in order, we get the following seque
阅读全文
摘要:Given a collection of intervals, merge all overlapping intervals. Example 1: Example 2: NOTE: input types have been changed on April 15, 2019. Please
阅读全文
摘要:iven an integer array nums, find the contiguous subarray (containing at least one number) which has the largest sum and return its sum. Example: Follo
阅读全文
摘要:Implement pow(x, n), which calculates x raised to the power n(xn). Example 1: Example 2: Example 3: Note: -100.0 < x < 100.0 n is a 32-bit signed inte
阅读全文
摘要:Given a collection of numbers that might contain duplicates, return all possible unique permutations. Example: 有重复数字的情况,之前在Subsets II,我们采取的是在某一个递归内,用f
阅读全文
摘要:Given a collection of distinct integers, return all possible permutations. Example: 规律:类似插入排序,每个数都有多个可插入的位置。 递归的时候:循环插入的位置。递归结束条件:插入到最后一个数。
阅读全文
摘要:Given an array of non-negative integers, you are initially positioned at the first index of the array. Each element in the array represents your maxim
阅读全文
摘要:Given two non-negative integers num1 and num2represented as strings, return the product of num1 and num2, also represented as a string. Example 1: Exa
阅读全文
摘要:Given n non-negative integers representing an elevation map where the width of each bar is 1, compute how much water it is able to trap after raining.
阅读全文
摘要:Given an unsorted integer array, find the smallest missing positive integer. Example 1: Example 2: Example 3: Note: Your algorithm should run in O(n)
阅读全文
摘要:Given a collection of candidate numbers (candidates) and a target number (target), find all unique combinations in candidates where the candidate numb
阅读全文
摘要:Given a set of candidate numbers (candidates) (without duplicates) and a target number (target), find all unique combinations in candidates where the
阅读全文
摘要:Given an array of integers nums sorted in ascending order, find the starting and ending position of a given targetvalue. Your algorithm's runtime comp
阅读全文
摘要:Implement next permutation, which rearranges numbers into the lexicographically next greater permutation of numbers. If such arrangement is not possib
阅读全文
摘要:Given a string containing just the characters '(' and ')', find the length of the longest valid (well-formed) parentheses substring. Example 1: Exampl
阅读全文
摘要:Implement next permutation, which rearranges numbers into the lexicographically next greater permutation of numbers. If such arrangement is not possib
阅读全文