PracHub
QuestionsCoachesLearningGuidesInterview Prep

Quick Overview

This question evaluates array manipulation, algorithmic efficiency, and familiarity with the sliding-window technique for computing metrics over fixed-length contiguous subarrays.

  • hard
  • DoorDash
  • Coding & Algorithms
  • Analytics Engineer

Find Maximum Window Sum

Company: DoorDash

Role: Analytics Engineer

Category: Coding & Algorithms

Difficulty: hard

Interview Round: Technical Screen

Given an integer array nums and an integer k, write code to find the maximum sum of any contiguous subarray of length exactly k. Assume 1 <= k <= len(nums), values may be negative, and the expected solution should run in O(n) time using a sliding-window approach.

Quick Answer: This question evaluates array manipulation, algorithmic efficiency, and familiarity with the sliding-window technique for computing metrics over fixed-length contiguous subarrays.

Return the maximum sum of any contiguous subarray of length exactly k.

Constraints

  • Inputs are provided as Python literals matching the function signature.
  • Return a deterministic exact-match result.

Examples

Input: ([1,2,3,4,5], 2)

Expected Output: 9

Explanation: Best length-two window.

Input: ([-5,-2,-3], 2)

Expected Output: -5

Explanation: All negative.

Input: ([7], 1)

Expected Output: 7

Explanation: Single element.

Hints

  1. Choose a representation that makes the core operation simple.
  2. Handle empty and boundary inputs before the main algorithm.
Last updated: Jun 27, 2026

Loading coding console...

PracHub

Master your tech interviews with 8,000+ real questions from top companies.

Product

  • Questions
  • Learning Tracks
  • Interview Guides
  • Resources
  • Premium
  • For Universities
  • Student Access

Browse

  • By Company
  • By Role
  • By Category
  • Topic Hubs
  • SQL Questions
  • AI Coding Questions
  • Compare Platforms
  • Discord Community

Support

  • support@prachub.com
  • (916) 541-4762

Legal

  • Privacy Policy
  • Terms of Service
  • About Us

© 2026 PracHub. All rights reserved.

Related Coding Questions

  • Validate a Shopping Cart - DoorDash (medium)
  • Calculate Driver Payments - DoorDash (medium)
  • Implement Timeout Refund Workflow - DoorDash (medium)
  • Maximize Chef Assignment Profit - DoorDash (medium)
  • Compute Courier Delivery Pay - DoorDash (easy)