![](https://img-blog.csdnimg.cn/20201014180756738.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
LeetCode
OovEver
这个作者很懒,什么都没留下…
展开
-
729. My Calendar I
729. My Calendar I题目描述:Implement a MyCalendar class to store your events. A new event can be added if adding the event will not cause a double booking.Your class will have the method, book(int start,原创 2017-11-28 15:06:13 · 356 阅读 · 0 评论 -
78. Subsets
78. Subsets题目描述:Given a set of distinct integers, nums, return all possible subsets (the power set).Note: The solution set must not contain duplicate subsets.For example, If nums = [1,2,3], a solutio原创 2017-11-28 15:24:05 · 184 阅读 · 0 评论 -
731. My Calendar II
731. My Calendar II题目描述:Implement a MyCalendarTwo class to store your events. A new event can be added if adding the event will not cause a triple booking.Your class will have one method, book(int sta原创 2017-11-28 15:45:10 · 1237 阅读 · 0 评论 -
152. Maximum Product Subarray
152. Maximum Product Subarray题目描述:Find the contiguous subarray within an array (containing at least one number) which has the largest product.For example, given the array [2,3,-2,4], the contiguous s原创 2017-11-28 16:07:49 · 180 阅读 · 0 评论 -
718. Maximum Length of Repeated Subarray
718. Maximum Length of Repeated Subarray题目描述:Given two integer arrays A and B, return the maximum length of an subarray that appears in both arrays.Example 1: Input:A: [1,2,3,2,1]B: [3,2,1,4,7]Ou原创 2017-11-28 16:19:08 · 158 阅读 · 0 评论 -
18. 4Sum
18. 4SumGiven an array S of n integers, are there elements a, b, c, and d in S such that a + b + c + d = target? Find all unique quadruplets in the array which gives the sum of target.Note: The soluti原创 2017-11-28 16:41:03 · 161 阅读 · 0 评论 -
670. Maximum Swap
670. Maximum SwapGiven a non-negative integer, you could swap two digits at most once to get the maximum valued number. Return the maximum valued number you could get.Example 1: Input: 2736Output:原创 2017-11-28 17:05:39 · 270 阅读 · 0 评论 -
81. Search in Rotated Sorted Array II
81. Search in Rotated Sorted Array IISuppose an array sorted in ascending order is rotated at some pivot unknown to you beforehand.(i.e., 0 1 2 4 5 6 7 might become 4 5 6 7 0 1 2).Write a function to原创 2017-11-28 17:18:40 · 175 阅读 · 0 评论 -
90. Subsets II
90. Subsets IIGiven a collection of integers that might contain duplicates, nums, return all possible subsets (the power set).Note: The solution set must not contain duplicate subsets.For example, I原创 2017-11-28 17:25:30 · 209 阅读 · 0 评论 -
33. Search in Rotated Sorted Array
33. Search in Rotated Sorted ArraySuppose an array sorted in ascending order is rotated at some pivot unknown to you beforehand.(i.e., 0 1 2 4 5 6 7 might become 4 5 6 7 0 1 2).You are given a target原创 2017-11-29 15:01:36 · 417 阅读 · 0 评论 -
55. Jump Game
55. Jump GameGiven an array of non-negative integers, you are initially positioned at the first index of the array.Each element in the array represents your maximum jump length at that position.Determ原创 2017-11-29 15:03:26 · 192 阅读 · 0 评论 -
713.Subarray Product Less Than K
713.Subarray Product Less Than KYour are given an array of positive integers nums. Count and print the number of (contiguous) subarrays where the product of all the elements in the subarray is less t原创 2017-11-29 15:04:36 · 384 阅读 · 0 评论 -
79. Word Search
79. Word SearchGiven a 2D board and a word, find if the word exists in the grid.The word can be constructed from letters of sequentially adjacent cell, where “adjacent” cells are those horizontally or原创 2017-11-29 15:06:07 · 188 阅读 · 0 评论 -
39. Combination Sum
39. Combination SumGiven a set of candidate numbers (C) (without duplicates) and a target number (T), find all unique combinations in C where the candidate numbers sums to T.The same repeated number m原创 2017-11-29 15:07:13 · 185 阅读 · 0 评论 -
714. Best Time to Buy and Sell Stock with Transaction Fee
714. Best Time to Buy and Sell Stock with Transaction FeeYour are given an array of integers prices, for which the i-th element is the price of a given stock on day i; and a non-negative integer fee r原创 2017-11-29 15:08:06 · 320 阅读 · 0 评论 -
31. Next Permutation
31. Next PermutationImplement next permutation, which rearranges numbers into the lexicographically next greater permutation of numbers.If such arrangement is not possible, it must rearrange it as the原创 2017-11-29 15:09:05 · 234 阅读 · 0 评论 -
621. Task Scheduler
621. Task SchedulerGiven a char array representing tasks CPU need to do. It contains capital letters A to Z where different letters represent different tasks.Tasks could be done without original order原创 2017-11-29 15:09:57 · 250 阅读 · 0 评论 -
229. Majority Element II
229. Majority Element IIGiven an integer array of size n, find all elements that appear more than ⌊ n/3 ⌋ times. The algorithm should run in linear time and in O(1) space.题目大意:给定一个大小为n的integer数组,找出出现原创 2017-11-29 15:10:49 · 150 阅读 · 0 评论 -
56. Merge Intervals
56. Merge IntervalsGiven a collection of intervals, merge all overlapping intervals.For example, Given [1,3],[2,6],[8,10],[15,18], return [1,6],[8,10],[15,18].题目大意:给定两个interval,合并两个Interval的公共部分。思原创 2017-11-29 15:11:34 · 199 阅读 · 0 评论 -
678. Valid Parenthesis String
678. Valid Parenthesis String题目大意:Given a string containing only three types of characters: ‘(‘, ‘)’ and ‘*’, write a function to check whether this string is valid. We define the validity of a string原创 2017-12-08 21:02:33 · 549 阅读 · 0 评论 -
647. Palindromic Substrings
647. Palindromic Substrings题目描述:Given a string, your task is to count how many palindromic substrings in this string.The substrings with different start indexes or end indexes are counted as different原创 2017-12-08 21:18:58 · 210 阅读 · 0 评论 -
583.Delete Operation for Two Strings
583.Delete Operation for Two Strings题目描述:Given two words word1 and word2, find the minimum number of steps required to make word1 and word2 the same, where in each step you can delete one character in原创 2017-12-08 21:51:32 · 207 阅读 · 0 评论 -
15. 3Sum
15. 3SumGiven an array S of n integers, are there elements a, b, c in S such that a + b + c = 0? Find all unique triplets in the array which gives the sum of zero.Note: The solution set must not conta原创 2017-11-30 20:44:49 · 171 阅读 · 0 评论 -
16. 3Sum Closest
16. 3Sum ClosestGiven an array S of n integers, find three integers in S such that the sum is closest to a given number, target. Return the sum of the three integers. You may assume that each input wo原创 2017-11-30 20:46:31 · 151 阅读 · 0 评论 -
380. Insert Delete GetRandom O(1)
380. Insert Delete GetRandom O(1)insert(val): Inserts an item val to the set if not already present. remove(val): Removes an item val from the set if present. getRandom: Returns a random element fro原创 2017-11-30 20:47:05 · 168 阅读 · 0 评论 -
62. Unique Paths
62. Unique PathsA 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 point in time. The robot is trying t原创 2017-11-30 20:47:43 · 147 阅读 · 0 评论 -
63. Unique Paths II
63. Unique Paths IIFollow 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 is marked as 1 and 0 respectivel原创 2017-11-30 20:48:13 · 180 阅读 · 0 评论 -
64. Product of Array Except Self
64. Product of Array Except SelfGiven an array of n integers where n > 1, nums, return an array output such that output[i] is equal to the product of all the elements of nums except nums[i]. Solve it原创 2017-11-30 20:48:43 · 166 阅读 · 0 评论 -
文章标题
73. Set Matrix ZeroesGiven a m x n matrix, if an element is 0, set its entire row and column to 0. Do it in place题目大意:给定一个m*n的矩阵,如果矩阵的行或者列包含0元素,则将矩阵的整行和整列都设为0。- 思路:见代码代码: public class Solution {原创 2017-11-30 20:49:51 · 158 阅读 · 0 评论 -
128. Longest Consecutive Sequence
128. Longest Consecutive Sequence题目描述:Given an unsorted array of integers, find the length of the longest consecutive elements sequence.For example, Given [100, 4, 200, 1, 3, 2], The longest consecu原创 2017-11-30 20:51:29 · 197 阅读 · 0 评论 -
45. Jump Game II
45. Jump Game II题目描述: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 maximum jump length at that positio原创 2017-11-30 20:52:06 · 158 阅读 · 0 评论 -
41. First Missing Positive
41. First Missing Positive题目描述:Given an unsorted integer array, find the first missing positive integer. For example, Given [1,2,0] return 3, and [3,4,-1,1] return 2. Your algorithm should run原创 2017-11-30 21:08:01 · 169 阅读 · 0 评论 -
49.Group Anagrams
49.Group Anagrams题目描述:Given an array of strings, group anagrams together.For example, given: ["eat", "tea", "tan", "ate", "nat", "bat"], Return: [ ["ate", "eat","tea"], ["nat","tan"], ["bat"原创 2017-12-08 22:19:45 · 216 阅读 · 0 评论 -
3.Longest Substring Without Repeating Characters
3.Longest Substring Without Repeating Characters题目描述:Given a string, find the length of the longest substring without repeating characters.Examples:Given "abcabcbb", the answer is "abc", which the le原创 2017-12-09 14:19:33 · 126 阅读 · 0 评论 -
8. String to Integer (atoi)
### 8. String to Integer (atoi)题目描述:Implement atoi to convert a string to an integer.Hint: Carefully consider all possible input cases. If you want a challenge, please do not see below and ask yoursel原创 2017-12-09 14:55:36 · 148 阅读 · 0 评论 -
43.Multiply Strings
43.Multiply Strings题目描述:Given two non-negative integers num1 and num2 represented as strings, return the product of num1 and num2.题目大意:给定两个非负整数num1与num2,返回num1与num相乘后的结果思路:从右到左,对每一对数字进行乘法运算,并将它们加在一起原创 2017-12-09 15:40:10 · 389 阅读 · 0 评论 -
71.Simplify Path
71.Simplify Path题目描述:Given an absolute path for a file (Unix-style), simplify it.For example, path = "/home/", => "/home" path = "/a/./b/../../c/", => "/c"题目含义:简化path代码package String;import java.u原创 2017-12-09 16:33:03 · 170 阅读 · 0 评论 -
5.Longest Palindromic Substring
5.Longest Palindromic Substring题目描述:Given a string s, find the longest palindromic substring in s. You may assume that the maximum length of s is 1000.Example: Input: "babad"Output: "bab"Note: "aba原创 2017-12-09 17:05:53 · 143 阅读 · 0 评论 -
41. First Missing Positive
41. First Missing Positive题目描述:Given n non-negative integers representing the histogram’s bar height where the width of each bar is 1, find the area of largest rectangle in the histogra题目大意:给定n个正整数代表原创 2017-12-01 11:14:00 · 202 阅读 · 0 评论 -
695 Max Area of Island
695 Max Area of Island题目描述Given a non-empty 2D array grid of 0’s and 1’s, an island is a group of 1’s (representing land) connected 4-directionally (horizontal or vertical.) You may assume all four ed原创 2017-11-22 12:44:52 · 443 阅读 · 0 评论