这是悦乐书的第 267 次更新,第 281 篇原创 01 看题和准备 今天介绍的是LeetCode算法题中Easy级别的第134题(顺位题号是581)。给定一个整数数组,找到一个连续的子数组,按升序对该子数组进行排序,使得整个数组也按升序排序。找到最短的无序连续子数组并输出其长度。例如: 输入:[2 ...
分类:
编程语言 时间:
2019-03-05 09:23:07
阅读次数:
154
Given an array A of 0s and 1s, we may change up to K values from 0 to 1. Return the length of the longest (contiguous) subarray that contains only 1s. ...
分类:
其他好文 时间:
2019-03-04 09:50:29
阅读次数:
92
Let's call any (contiguous) subarray B (of A) a mountain if the following properties hold: B.length >= 3 There exists some 0 < i < B.length - 1 such t ...
分类:
编程语言 时间:
2019-03-02 01:08:18
阅读次数:
221
题目描述 给定一个含有 n 个正整数的数组和一个正整数 s ,找出该数组中满足其和 ≥ s 的长度最小的连续子数组。如果不存在符合条件的连续子数组,返回 0。 示例: 解题思路 记录当前的连续子数组和,若大于等于s,则以当前子数组的最左端为基准向后遍历,若去掉此数后当前连续子数组和仍大于等于s,就把 ...
分类:
编程语言 时间:
2019-03-01 15:30:01
阅读次数:
221
https://leetcode.com/tag/two-pointers/ ...
分类:
其他好文 时间:
2019-02-27 01:26:41
阅读次数:
164
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 of ...
分类:
其他好文 时间:
2019-02-24 10:27:27
阅读次数:
124
Given an integer array nums, find the contiguous subarray within an array (containing at least one number) which has the largest product. Example 1: I ...
分类:
其他好文 时间:
2019-02-24 10:25:23
阅读次数:
185
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 ...
分类:
其他好文 时间:
2019-02-24 10:23:35
阅读次数:
121
題目 : Given an integer array nums, find the contiguous subarray(containing at least one number) which has the largest sum and return its sum. Example:I ...
分类:
编程语言 时间:
2019-02-23 01:11:32
阅读次数:
263
Given an integer array, you need to find one continuous subarray that if you only sort this subarray in ascending order, then the whole array will be ...
分类:
其他好文 时间:
2019-02-20 09:28:13
阅读次数:
114