LeetCode
develbai
所有时间管理的背后,是良好的习惯,而良好习惯养成的背后,是惊人的意志力
展开
-
LeetCode 34. Search for a Range
LeetCode 34. Search for a RangeDescriptionGiven an array of integers sorted in ascending order, find the starting and ending position of a given target value.Your algorithm’s runtime complexity must be原创 2017-12-05 22:32:38 · 123 阅读 · 0 评论 -
LeetCode 344. Reverse String
LeetCode 344. Reverse StringDescriptionWrite a function that takes a string as input and returns the string reversed.Example: Given s = “hello”, return “olleh”. class Solution {原创 2018-01-17 22:09:28 · 135 阅读 · 0 评论 -
LeetCode 345. Reverse Vowels of a String
LeetCode 345. Reverse Vowels of a StringDescriptionWrite a function that takes a string as input and reverse only the vowels of a string.Example 1:Given s = “hello”, return “holle”.Exa原创 2018-01-17 22:10:49 · 132 阅读 · 0 评论 -
LeetCode 11. Container With Most Water
LeetCode 11. Container With Most WaterDescriptionGiven 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 en原创 2018-01-18 22:03:01 · 136 阅读 · 0 评论 -
LeetCode 20. Valid Parentheses
LeetCode 20. Valid ParenthesesDescriptionGiven a string containing just the characters ‘(‘, ‘)’, ‘{‘, ‘}’, ‘[’ and ‘]’, determine if the input string is valid.The brackets must close in the co原创 2018-01-19 22:04:10 · 128 阅读 · 0 评论 -
LeetCode 9. Palindrome Number
LeetCode 9. Palindrome NumberDescriptionDetermine whether an integer is a palindrome. Do this without extra space. class Solution { public boolean isPalindrome(int x) {原创 2018-01-19 22:04:57 · 146 阅读 · 0 评论 -
LeetCode 438. Find All Anagrams in a String
LeetCode 438. Find All Anagrams in a StringDescriptionGiven a string s and a non-empty string p, find all the start indices of p’s anagrams in s.Strings consists of lowercase English letters o原创 2018-01-20 21:41:43 · 161 阅读 · 0 评论 -
LeetCode 387. First Unique Character in a String
387. First Unique Character in a StringDescriptionGiven a string, find the first non-repeating character in it and return it’s index. If it doesn’t exist, return -1.Examples:s = “leetcode”...原创 2018-03-01 21:55:30 · 229 阅读 · 1 评论 -
LeetCode 434. Number of Segments in a String
434. Number of Segments in a StringDescriptionCount the number of segments in a string, where a segment is defined to be a contiguous sequence of non-space characters.Please note that the stri...原创 2018-03-01 21:56:15 · 251 阅读 · 0 评论 -
LeetCode 125. Valid Palindrome
LeetCode 125. Valid PalindromeDescriptionGiven a string, determine if it is a palindrome, considering only alphanumeric characters and ignoring other cases.For example, “A man, a plan, a cana原创 2018-01-17 22:08:35 · 149 阅读 · 0 评论 -
LeetCode 167. Two Sum II - Input array is sorted
LeetCode 167. Two Sum II - Input array is sortedDescriptionGiven an array of integers that is already sorted in ascending order, find two numbers such that they add up to a specific target numbe原创 2018-01-17 22:07:10 · 122 阅读 · 0 评论 -
LeetCode 215. Kth Largest Element in an Array
LeetCode 215. Kth Largest Element in an ArrayDescriptionFind the kth largest element in an unsorted array. Note that it is the kth largest element in the sorted order, not the kth distinct eleme原创 2018-01-16 21:58:43 · 593 阅读 · 0 评论 -
LeetCode 728. Self Dividing Numbers
LeetCode 728. Self Dividing NumbersDescriptionA self-dividing number is a number that is divisible by every digit it contains.For example, 128 is a self-dividing number because 128 % 1 == 0, 128 % 2 ==原创 2017-12-06 21:21:26 · 195 阅读 · 0 评论 -
LeetCode 27. Remove Element
LeetCode 27. Remove ElementDescriptionGiven an array and a value, remove all instances of that value in-place and return the new length.Do not allocate extra space for another array, you must do this b原创 2017-12-06 21:25:16 · 179 阅读 · 1 评论 -
LeetCode 209. Minimum Size Subarray Sum
LeetCode 209. Minimum Size Subarray SumDescriptionGiven an array of n positive integers and a positive integer s, find the minimal length of a contiguous subarray of which the sum ≥ s. If there原创 2018-01-21 22:30:14 · 186 阅读 · 0 评论 -
LeetCode 76. Minimum Window Substring
76. Minimum Window SubstringDescriptionGiven 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).For example, S = “ADOBECODEB原创 2018-01-21 22:31:20 · 193 阅读 · 0 评论 -
LeetCode 3. Longest Substring Without Repeating Characters
leetCode 3. Longest Substring Without Repeating CharactersDescriptionGiven a string, find the length of the longest substring without repeating characters.Examples:Given “abcabcbb”, the an原创 2018-01-20 21:40:49 · 149 阅读 · 0 评论 -
LeetCode 80. Remove Duplicates from Sorted Array II
LeetCode 80. Remove Duplicates from Sorted Array IIDescriptionFollow up for “Remove Duplicates”: What if duplicates are allowed at most twice?For example, Given sorted array nums = [1,1,1,2,原创 2018-01-16 21:53:03 · 129 阅读 · 0 评论 -
LeetCode 75. Sort Colors
LeetCode 75. Sort ColorsDescriptionGiven 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, white and原创 2018-01-16 21:56:25 · 180 阅读 · 0 评论 -
LeetCode 88. Merge Sorted Array
LeetCode 88. Merge Sorted ArrayDescriptionGiven two sorted integer arrays nums1 and nums2, merge nums2 into nums1 as one sorted array.Note:You may assume that nums1 has enough space (size原创 2018-01-16 21:57:52 · 196 阅读 · 0 评论 -
LeetCode 56. Merge Intervals
56. Merge IntervalsDescriptionGiven 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]. class Soluti...原创 2018-03-01 21:57:10 · 248 阅读 · 0 评论