LeetCode 169. Majority Element

Given an array of size n, find the majority element. The majority element is the element that appears more than ⌊ n/2 ⌋ times.You may assume that the...

2018-03-07 09:40:05

阅读数:29

评论数:0

LeetCode 11. Container With Most Water(java)

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 endpoi...

2018-02-26 05:01:40

阅读数:42

评论数:0

LeetCode 658. Find K Closest Elements(java)

Given a sorted array, two integers k and x, find the k closest elements to x in the array. The result should also be sorted in ascending order. If th...

2018-02-25 17:31:31

阅读数:275

评论数:0

LeetCode 134. Gas Station(java)

There are N gas stations along a circular route, where the amount of gas at station i is gas[i].You have a car with an unlimited gas tank and it cost...

2018-02-25 17:08:04

阅读数:50

评论数:0

LeetCode 560. Subarray Sum Equals K(java)

Given an array nums and a target value k, find the maximum length of a subarray that sums to k. If there isn’t one, return 0 instead.Note: The sum o...

2018-02-25 08:59:20

阅读数:41

评论数:0

LeetCode 325. Maximum Size Subarray Sum Equals k(java)

Given an array nums and a target value k, find the maximum length of a subarray that sums to k. If there isn’t one, return 0 instead.Note: The sum o...

2018-02-25 08:26:15

阅读数:40

评论数:0

LeetCode 713. Subarray Product Less Than K(java)

Your 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 s...

2018-02-25 08:14:08

阅读数:41

评论数:0

LeetCode 152. Maximum Product Subarray(java)

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], ...

2018-02-25 07:30:20

阅读数:29

评论数:0

LeetCode 76. Minimum Window Substring(java)

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).For example, S = "AD...

2018-02-12 11:41:53

阅读数:33

评论数:0

LeetCode 53. Maximum Subarray

Find the contiguous subarray within an array (containing at least one number) which has the largest sum.For example, given the array [-2,1,-3,4,-1,2,...

2018-02-12 09:17:36

阅读数:36

评论数:0

LeetCode 674. Longest Continuous Increasing Subsequence(java)

Given an unsorted array of integers, find the length of longest continuous increasing subsequence (subarray).Example 1: Input: [1,3,5,4,7] Output: 3 ...

2018-02-11 15:56:35

阅读数:46

评论数:0

LeetCode 480. Sliding Window Median(java)

Median is the middle value in an ordered integer list. If the size of the list is even, there is no middle value. So the median is the mean of the tw...

2018-02-09 11:44:58

阅读数:48

评论数:0

LeetCode 163. Missing Ranges(java)

Given a sorted integer array where the range of elements are in the inclusive range [lower, upper], return its missing ranges.For example, given [0, ...

2018-02-05 10:45:41

阅读数:67

评论数:0

LeetCode 228. Summary Ranges(java)

Given a sorted integer array without duplicates, return the summary of its ranges.Example 1: Input: [0,1,2,4,5,7] Output: ["0->2","...

2018-02-05 09:50:13

阅读数:420

评论数:0

LeetCode 80. Remove Duplicates from Sorted Array II(java)

Follow up for “Remove Duplicates”: What if duplicates are allowed at most twice?For example, Given sorted array nums = [1,1,1,2,2,3],Your function ...

2018-02-04 09:51:52

阅读数:23

评论数:0

LeetCode 26. Remove Duplicates from Sorted Array(java)

Given a sorted array, remove the duplicates in-place such that each element appear only once and return the new length.Do not allocate extra space fo...

2018-02-04 09:50:05

阅读数:26

评论数:0

532. K-diff Pairs in an Array(java)

Given an array of integers and an integer k, you need to find the number of unique k-diff pairs in the array. Here a k-diff pair is defined as an int...

2018-02-04 09:07:33

阅读数:39

评论数:0

LeetCode Maximum Product of Three Number s(java)

Given an integer array, find three numbers whose product is maximum and output the maximum product.Example 1: Input: [1,2,3] Output: 6Example 2: Inpu...

2018-02-04 05:22:26

阅读数:23

评论数:0

LeetCode 724. Find Pivot Index(java)

Given an array of integers nums, write a method that returns the “pivot” index of this array.We define the pivot index as the index where the sum of ...

2018-02-04 04:42:22

阅读数:115

评论数:0

LeetCode 295. Find Median from Data Stream(java)

Median is the middle value in an ordered integer list. If the size of the list is even, there is no middle value. So the median is the mean of the tw...

2018-02-03 13:48:34

阅读数:32

评论数:0

提示
确定要删除当前文章?
取消 删除
关闭
关闭