FastPrepInventory Processes Survival Possibility
Problems/Inventory Processes Survival Possibility

Inventory Processes Survival Possibility

Amazon logoAmazon● MediumFULLTIMEOA

Updated Sep 2026

QuestionFunctionExamplesConstraints

Problem statement

There are n inventory processes. Process i initially controls bots[i] bots.

In each round, choose any two remaining processes. The process with more bots defeats the other and absorbs all of its bots. If their bot counts are equal, either process may be chosen as the winner. Rounds continue until one process remains.

Return, in ascending order, the 1-based indices of all processes that can be the final survivor for at least one possible sequence of rounds.

Function

inventoryProcessesSurvivalPossibility(n: int, bots: int[]) → int[]

Examples

Example 1

n = 5bots = [1, 6, 2, 7, 2]return = [2, 4]

Process 2 can first absorb processes 1 and 3, growing from 6 to 9. It can then defeat process 4 and process 5, so it can finish with all 18 bots.

Process 4 can absorb processes 1 and 3, then defeat process 2 and process 5, so it can also finish with all 18 bots. No other process can survive every required matchup, so return [2, 4].

Constraints

  • 1 <= n <= 200000
  • 1 <= bots[i] <= 10^9
  • bots.length = n

More Amazon interview questions

  • LRU Cache for Query ResultsPHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
  • Maximal SquareONSITE INTERVIEW · Seen Nov 2026
  • Serialize and Deserialize a Binary TreeONSITE INTERVIEW · Seen Nov 2026
  • Course SchedulePHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
  • Course Schedule IIPHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
  • Diagonal Traversal of a Binary TreeONSITE INTERVIEW · Seen Nov 2026
  • Minimum Time to Spread Through a GridPHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
  • Consistent-Hash Packet RouterPHONE SCREEN · Seen Nov 2026
  • Count Connected ComponentsPHONE SCREEN · Seen Nov 2026
  • Maximize K-Element AND with an Increment BudgetOA · Seen Nov 2026

Similar questions at other companies

  • Minimum Rounds to Complete All TasksInfosys · OAInfosys interview questions
  • Server Upgrade PlanningWells Fargo · OAWells Fargo interview questions
  • Task Scheduler with CooldownGoDaddy · OA
  • Minimize Adjacent Squared-Difference Cost with One InsertionMcKinsey & Company · OAMcKinsey & Company interview questions
  • Maximize Revenue from Decreasing InventoryChubb · OAChubb interview questions
  • Minimum Values with Even Powers of TwoVisa · OAVisa interview questions
  • Minimize Adjacent Squared-Difference Cost with One InsertionMicrosoft · OAMicrosoft interview questions
  • Minimum Halvings for Alternating ParityIBM · OAIBM interview questions
  • Resource AllocationMaven Securities · OAMaven Securities interview questions
  • Return Exact Cash Register ChangeBank of America · OA

Interview reports that mention this question

  • Amazon Full-Time OA Problems, Recent Reports (Part 4 of 5)

Amazon interview experiences

  • Amazon Experienced SDE Onsite Questions: 1 Experience
  • Amazon SDE Onsite Interview Questions: 9 Experiences
  • Amazon SDE II and L5 FDE Interview Questions: 4 Experiences
  • Amazon Full-Time OA Problems, Earlier Reports (Part 5 of 5)
  • Amazon New Grad OA Problems: Every Task We Have (Part 3 of 5)
See Amazon hiring insights
Saved
class Solution {
    public int[] inventoryProcessesSurvivalPossibility(int n, int[] robots) {
      // write your code here
    }

}
Checking account…