Array
WX_ming
写代码就像写作文一样,思路要明确,方法要对,否则又臭又长还出错
展开
-
LeetCode 792. Number of Matching Subsequences C++
792. Number of Matching SubsequencesGiven string S and a dictionary of words words, find the number of words[i] that is a subsequence of S.Example :Input: S = "abcde"words = ["a", "bb", &q原创 2018-08-22 12:29:53 · 380 阅读 · 0 评论 -
LeetCode 238. Product of Array Except Self C++
238. Product of Array Except SelfGiven an array nums of n integers where n > 1, return an array output such that output[i] is equal to the product of all the elements of nums except nums[i].Ex...原创 2018-08-17 16:20:36 · 216 阅读 · 0 评论 -
LeetCode 73. Set Matrix Zeroes C++
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.Example 1:Input: [ [1,1,1], [1,0,1], [1,1,1]]Output: [ [1,0,1], ...原创 2018-08-20 15:35:19 · 165 阅读 · 0 评论 -
LeetCode 229. Majority Element II C++
229. Majority Element IIGiven an integer array of size n, find all elements that appear more than ⌊ n/3 ⌋ times.Note: The algorithm should run in linear time and in O(1) space.Example 1:Inpu...原创 2018-08-20 21:48:27 · 272 阅读 · 0 评论 -
LeetCode 795. Number of Subarrays with Bounded Maximum C++
795. Number of Subarrays with Bounded MaximumWe are given an array A of positive integers, and two positive integers L and R (L <= R).Return the number of (contiguous, non-empty) subarrays such...原创 2018-08-21 10:17:01 · 175 阅读 · 0 评论 -
LeetCode 835. Image Overlap C++
835. Image OverlapTwo images A and B are given, represented as binary, square matrices of the same size. (A binary matrix has only 0s and 1s as values.)We translate one image however we choose (s...原创 2018-08-21 12:18:16 · 998 阅读 · 0 评论 -
LeetCode 665. Non-decreasing Array C++
665. Non-decreasing ArrayGiven an array with n integers, your task is to check if it could become non-decreasing by modifying at most 1 element.We define an array is non-decreasing if array[i] <...原创 2018-08-21 16:59:43 · 187 阅读 · 0 评论 -
LeetCode 42. Trapping Rain Water
42. Trapping Rain WaterGiven 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.The above elevation map ...原创 2019-02-03 20:04:41 · 242 阅读 · 0 评论