We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent bc23fa6 commit 78f639fCopy full SHA for 78f639f
solution/3400-3499/3430.Maximum and Minimum Sums of at Most Size K Subarrays/Solution.js
@@ -3,13 +3,13 @@
3
* @param {number} k
4
* @return {number}
5
*/
6
-var minMaxSubarraySum = function(nums, k) {
+var minMaxSubarraySum = function (nums, k) {
7
const computeSum = (nums, k, isMin) => {
8
const n = nums.length;
9
const prev = new Array(n).fill(-1);
10
const next = new Array(n).fill(n);
11
let stack = [];
12
-
+
13
if (isMin) {
14
for (let i = 0; i < n; i++) {
15
while (stack.length > 0 && nums[stack[stack.length - 1]] >= nums[i]) {
0 commit comments