89. Gray Code
摘要:The gray code is a binary numeral system where two successive values differ in only one bit. Given a non-negative integer n representing the total num
阅读全文
22. Generate Parentheses
摘要:Given n pairs of parentheses, write a function to generate all combinations of well-formed parentheses. For example, given n = 3, a solution set is: [
阅读全文
11. Container With Most Water
摘要:Given n non-negative integers a1, a2, ..., an , where each represents a point at coordinate (i, ai). n vertical lines are drawn such that the two endp
阅读全文
50. Pow(x, n)
摘要:50. Pow(x, n) Medium 10082426FavoriteShare 50. Pow(x, n) Medium 10082426FavoriteShare Medium Implement pow(x, n), which calculates x raised to the pow
阅读全文
49. Group Anagrams
摘要:Given an array of strings, group anagrams together. Example: Note: All inputs will be in lowercase. The order of your output does not matter. 基本的遍历练手题
阅读全文
48. Rotate Image
摘要:You are given an n x n 2D matrix representing an image. Rotate the image by 90 degrees (clockwise). Note: You have to rotate the image in-place, which
阅读全文
64. Minimum Path Sum
摘要:Given a m x n grid filled with non-negative numbers, find a path from top left to bottom right which minimizes the sum of all numbers along its path.
阅读全文
63. Unique Paths II
摘要: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
阅读全文
62. Unique Paths
摘要: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
阅读全文
53. Maximum Subarray
摘要:Given an integer array nums, find the contiguous subarray (containing at least one number) which has the largest sum and return its sum. Example: Inpu
阅读全文
14. Longest Common Prefix
摘要:Write a function to find the longest common prefix string amongst an array of strings. If there is no common prefix, return an empty string "". Exampl
阅读全文
96. Unique Binary Search Trees
摘要:Given n, how many structurally unique BST's (binary search trees) that store values 1 ... n? Example: Input: 3 Output: 5 Explanation: Given n = 3, the
阅读全文
91. Decode Ways
摘要:A message containing letters from A-Z is being encoded to numbers using the following mapping: Given a non-empty string containing only digits, determ
阅读全文
70. Climbing Stairs
摘要: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
阅读全文
32. Longest Valid Parentheses
摘要:Given a string containing just the characters '(' and ')', find the length of the longest valid (well-formed) parentheses substring. Example 1: Exampl
阅读全文
42. Trapping Rain Water
摘要: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.
阅读全文
41. First Missing Positive
摘要:41. First Missing Positive Hard 2193655FavoriteShare 41. First Missing Positive Hard 2193655FavoriteShare Hard Given an unsorted integer array, find t
阅读全文
40. Combination Sum II
摘要:Given a collection of candidate numbers (candidates) and a target number (target), find all unique combinations in candidates where the candidate numb
阅读全文
39. Combination Sum
摘要:Given a set of candidate numbers (candidates) (without duplicates) and a target number (target), find all unique combinations in candidates where the
阅读全文
38. Count and Say
摘要:The count-and-say sequence is the sequence of integers with the first five terms as following: 1 is read off as "one 1" or 11.11 is read off as "two 1
阅读全文
36. Valid Sudoku
摘要:Determine if a 9x9 Sudoku board is valid. Only the filled cells need to be validated according to the following rules: A partially filled sudoku which
阅读全文
19. Remove Nth Node From End of List
摘要:Given a linked list, remove the n-th node from the end of list and return its head. Example: Note: Given n will always be valid. Follow up: Could you
阅读全文
23. Merge k Sorted Lists
摘要:Merge k sorted linked lists and return it as one sorted list. Analyze and describe its complexity. Example:
阅读全文
7. Reverse Integer
摘要:Given a 32-bit signed integer, reverse digits of an integer. Example 1: Example 2: Example 3: Note:Assume we are dealing with an environment which cou
阅读全文
5. Longest Palindromic Substring
摘要:5. Longest Palindromic Substring Medium 4506406FavoriteShare 5. Longest Palindromic Substring Medium 4506406FavoriteShare Medium Given a string s, fin
阅读全文
4. Median of Two Sorted Arrays
摘要:There are two sorted arrays nums1 and nums2 of size m and n respectively. Find the median of the two sorted arrays. The overall run time complexity sh
阅读全文
1072. Flip Columns For Maximum Number of Equal Rows
摘要:1072. Flip Columns For Maximum Number of Equal Rows Medium 13114FavoriteShare 1072. Flip Columns For Maximum Number of Equal Rows Medium 13114Favorite
阅读全文