← 返回 bytedance 的题目列表Subarray / Sliding Window vs Prefix Sum
类型:online_judge
Problem: Subarray / Sliding Window (Prefix Sum also works)
Given an integer array nums and an integer parameter k (or target), compute a result related to contiguous subarrays.
Interview hints:
You proposed a sliding window approach.
The interviewer mentioned a prefix sum approach, and said sliding window can also work.
Note: The original interview note does not specify the exact metric to compute (e.g., count of subarrays with sum == k, minimum length with sum >= target, etc.) nor whether negatives exist, so a precise reconstructable prompt is not available.