08 2018 档案
LeetCode765. Couples Holding Hands
摘要:N couples sit in 2N seats arranged in a row and want to hold hands. We want to know the minimum number of swaps so that every couple is sitting side b
阅读全文
LeetCode741. Cherry Pickup
摘要:https://leetcode.com/problems/cherry-pickup/description/ In a N x N grid representing a field of cherries, each cell is one of three possible integers
阅读全文
LeetCode312. Burst Balloons
摘要:Given n balloons, indexed from 0 to n-1. Each balloon is painted with a number on it represented by array nums. You are asked to burst all the balloon
阅读全文
LeetCode679. 24 Game
摘要:You have 4 cards each containing a number from 1 to 9. You need to judge whether they could operated through *, /, +, -, (, ) to get the value of 24.
阅读全文
LeetCode862. Shortest Subarray with Sum at Least K
摘要:Return the length of the shortest, non-empty, contiguous subarray of A with sum at least K. If there is no non-empty subarray with sum at least K, ret
阅读全文
LeetCode818. Race Car
摘要:https://leetcode.com/problems/race-car/description/ Your car starts at position 0 and speed +1 on an infinite number line. (Your car can go into negat
阅读全文
LeetCode解题报告—— Best Time to Buy and Sell Stock
摘要:Best Time to Buy and Sell Stock Say you have an array for which the ith element is the price of a given stock on day i. Design an algorithm to find th
阅读全文
LeetCode218. The Skyline Problem
摘要:https://leetcode.com/problems/the-skyline-problem/description/ A city's skyline is the outer contour of the silhouette formed by all the buildings in
阅读全文
LeetCode214. Shortest Palindrome
摘要:Given a string s, you are allowed to convert it to a palindrome by adding characters in front of it. Find and return the shortest palindrome you can f
阅读全文
LeetCode212. Word Search II
摘要:https://leetcode.com/problems/word-search-ii/description/ Given a 2D board and a list of words from the dictionary, find all words in the board. Each
阅读全文
LeetCode132. Palindrome Partitioning II
摘要:Given a string s, partition s such that every substring of the partition is a palindrome. Return the minimum cuts needed for a palindrome partitioning
阅读全文
LeetCode239. Sliding Window Maximum
摘要:Given an array nums, there is a sliding window of size k which is moving from the very left of the array to the very right. You can only see the k num
阅读全文
LeetCode解题报告—— Interleaving String
摘要:Given s1, s2, s3, find whether s3 is formed by the interleaving of s1 and s2. Example 1: Example 2: 思路 可以遍历s1和s2所能构成的所有可能的interlaving string。 We start
阅读全文
LeetCode解题报告—— Maximal Rectangle
摘要:Given a 2D binary matrix filled with 0's and 1's, find the largest rectangle containing only 1's and return its area. Example: 思路 看了下discussion,真的很难理解
阅读全文
LeetCode解题报告—— Minimum Window Substring && Largest Rectangle in Histogram
摘要:1. Minimum Window Substring Given a string S and a string T, find the minimum window in S which will contain all the characters in T in complexity O(n
阅读全文
LeetCode解题报告—— N-Queens && Edit Distance
摘要:1. N-Queens The n-queens puzzle is the problem of placing n queens on an n×n chessboard such that no two queens attack each other. Given an integer n,
阅读全文
LeetCode解题报告—— 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.
阅读全文
LeetCode解题报告—— 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
阅读全文
LeetCode解题报告—— Reverse Nodes in k-Group && Sudoku Solver
摘要:1. Reverse Nodes in k-Group Given a linked list, reverse the nodes of a linked list k at a time and return its modified list. k is a positive integer
阅读全文