PracHub
QuestionsPremiumLearningGuidesInterview PrepNEWCoaches
|Home/Coding & Algorithms/Amazon

Maximize credits with limited skips

Last updated: Mar 29, 2026

Quick Overview

This question evaluates algorithm design and optimization skills in resource allocation under constraints, focusing on decision-making to maximize credits when turn-taking and limited skips affect processing.

  • Medium
  • Amazon
  • Coding & Algorithms
  • Software Engineer

Maximize credits with limited skips

Company: Amazon

Role: Software Engineer

Category: Coding & Algorithms

Difficulty: Medium

Interview Round: Take-home Project

You are given n warehouses with inventories inventory[0..n-1], and two dispatch amounts: you dispatch dispatch1 units first each turn, then your co-worker dispatches dispatch2 units. Your co-worker may skip their turn a total of at most skips times across all warehouses; when they skip, you immediately take the next dispatch instead. For a warehouse i, a credit is earned only if the warehouse becomes empty (inventory[i] <= 0) immediately after your dispatch on that warehouse. Determine the maximum total number of credits achievable over all warehouses by optimally choosing when the co-worker skips. Return an integer. Constraints: 1 <= n <= 1e5; 1 <= inventory[i], dispatch1, dispatch2, skips <= 1e9. Describe the algorithm and its time and space complexity, and implement getMaximumCredits(inventory, dispatch1, dispatch2, skips).

Quick Answer: This question evaluates algorithm design and optimization skills in resource allocation under constraints, focusing on decision-making to maximize credits when turn-taking and limited skips affect processing.

Related Interview Questions

  • Count Connected Components in an Undirected Graph - Amazon (medium)
  • Find Unique Target-Sum Pairs - Amazon (easy)
  • Find Valid IP Addresses in Files - Amazon (medium)
  • Implement Optimal Bucket Batching - Amazon (hard)
  • Implement Cache and Rotate Matrix - Amazon (medium)
Amazon logo
Amazon
Sep 6, 2025, 12:00 AM
Software Engineer
Take-home Project
Coding & Algorithms
1
0

You are given n warehouses with inventories inventory[0..n-1], and two dispatch amounts: you dispatch dispatch1 units first each turn, then your co-worker dispatches dispatch2 units. Your co-worker may skip their turn a total of at most skips times across all warehouses; when they skip, you immediately take the next dispatch instead. For a warehouse i, a credit is earned only if the warehouse becomes empty (inventory[i] <= 0) immediately after your dispatch on that warehouse. Determine the maximum total number of credits achievable over all warehouses by optimally choosing when the co-worker skips. Return an integer. Constraints: 1 <= n <= 1e5; 1 <= inventory[i], dispatch1, dispatch2, skips <= 1e9. Describe the algorithm and its time and space complexity, and implement getMaximumCredits(inventory, dispatch1, dispatch2, skips).

Comments (0)

Sign in to leave a comment

Loading comments...

Browse More Questions

More Coding & Algorithms•More Amazon•More Software Engineer•Amazon Software Engineer•Amazon Coding & Algorithms•Software Engineer Coding & Algorithms
PracHub

Master your tech interviews with 7,500+ 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
  • Compare Platforms
  • Discord Community

Support

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

Legal

  • Privacy Policy
  • Terms of Service
  • About Us

© 2026 PracHub. All rights reserved.