摘要:
A subarray A[i], A[i+1], ..., A[j] of A is said to be turbulent if and only if: For i <= k < j, A[k] > A[k+1] when k is odd, and A[k] < A[k+1] when k 阅读全文
摘要:
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 阅读全文
摘要:
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 阅读全文
摘要:
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 阅读全文
摘要:
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 阅读全文
摘要:
Given a list of non-negative numbers and a target integer k, write a function to check if the array has a continuous subarray of size at least 2 that 阅读全文
摘要:
Given an array of integers and an integer k, you need to find the total number of continuous subarrays whose sum equals to k. Example 1: Note: Idea 1. 阅读全文
摘要:
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 阅读全文
摘要:
Given an array consisting of n integers, find the contiguous subarray whose length is greater than or equal to k that has the maximum average value. A 阅读全文
摘要:
Given an array consisting of n integers, find the contiguous subarray of given length k that has the maximum average value. And you need to output the 阅读全文