Tap here to switch tabs
Problem
Submissions

Problem: Maximum Size Subarray Sum Equals k

med
30 min
Try to solve the Maximum Size Subarray Sum Equals k problem.

Statement

Given an integer array nums and an integer k, return the maximum length of a contiguous subarray in nums whose elements sum to exactly k. If no such subarray exists, return 00.

Note: A subarray is a contiguous sequence of elements within nums.

Constraints:

  • 1≤1 \leq nums.length ≤2⋅105\leq 2 \cdot 10^5

  • −104≤-10^4 \leq nums[i] ≤104\leq 10^4

  • −109≤-10^9 \leq k ≤109\leq 10^9

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Maximum Size Subarray Sum Equals k

med
30 min
Try to solve the Maximum Size Subarray Sum Equals k problem.

Statement

Given an integer array nums and an integer k, return the maximum length of a contiguous subarray in nums whose elements sum to exactly k. If no such subarray exists, return 00.

Note: A subarray is a contiguous sequence of elements within nums.

Constraints:

  • 1≤1 \leq nums.length ≤2⋅105\leq 2 \cdot 10^5

  • −104≤-10^4 \leq nums[i] ≤104\leq 10^4

  • −109≤-10^9 \leq k ≤109\leq 10^9