C++,LeetCode
Edwardwe
新开博客,c++菜鸟是也···
展开
-
LeetCode 485. Max Consecutive Ones
Given a binary array, find the maximum number of consecutive 1s in this array.Example 1:Input: [1,1,0,1,1,1]Output: 3Explanation: The first two digits or the last three digits are consecutiv原创 2017-02-25 15:34:56 · 367 阅读 · 0 评论 -
198. House Robber LeetCode
题目描述:You are a professional robber planning to rob houses along a street. Each house has a certain amount of money stashed, the only constraint stopping you from robbing each of them is that adjac原创 2017-05-07 19:21:46 · 233 阅读 · 0 评论 -
134. Gas Station LeeCode
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 costs cost[i] of gas to travel from station i to原创 2017-04-25 13:22:28 · 299 阅读 · 0 评论 -
392. Is Subsequence LeetCode
Given a string s and a string t, check if s is subsequence of t.You may assume that there is only lower case English letters in both s and t. t is potentially a very long (length ~= 500,000) strin原创 2017-04-23 19:52:50 · 298 阅读 · 0 评论 -
209. Minimum Size Subarray Sum LeetCode
Given 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 isn't one, return 0 instead.For example, given the原创 2017-04-12 22:07:32 · 232 阅读 · 0 评论 -
541. Reverse String II LeetCode
题目:Given a string and an integer k, you need to reverse the first k characters for every 2k characters counting from the start of the string. If there are less than k characters left, reverse all原创 2017-03-26 19:30:48 · 254 阅读 · 0 评论 -
496. Next Greater Element I LeetCode
You are given two arrays (without duplicates) nums1 and nums2 where nums1’s elements are subset of nums2. Find all the next greater numbers for nums1's elements in the corresponding places of nums原创 2017-04-10 13:45:37 · 324 阅读 · 0 评论 -
169. Majority Element LeetCode
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 array is non-empty and the majority element原创 2017-03-07 19:53:05 · 279 阅读 · 0 评论 -
LeetCode 241. Different Ways to Add Parentheses
Given a string of numbers and operators, return all possible results from computing all the different possible ways to group numbers and operators. The valid operators are +, - and *.Example 1原创 2017-03-05 19:48:32 · 266 阅读 · 0 评论 -
LeetCode 503. Next Greater Element II
503. Next Greater Element IIGiven a circular array (the next element of the last element is the first element of the array), print the Next Greater Number for every element. The Next Greater Num原创 2017-02-25 16:27:33 · 341 阅读 · 0 评论 -
Range Sum Query 2D - Immutable LeetCode
题目:Given a 2D matrix matrix, find the sum of the elements inside the rectangle defined by its upper left corner (row1, col1) and lower right corner (row2, col2).The above rectangle (with t原创 2017-05-22 19:01:46 · 232 阅读 · 0 评论