Stable Robot Configurations
Updated
Problem statement
In Amazon's warehouse robotics system, multiple robots operate simultaneously to transport packages efficiently. Each robot can be in one of two states: Standby or Operating.
For smooth coordination, each robot i has a predefined coordination threshold, coordinationThreshold[i]. This threshold determines the conditions under which a robot malfunctions:
- A robot
imalfunctions if it is in theOperatingstate but the total number of other robots in theOperatingstate is less thancoordinationThreshold[i]. - A robot
imalfunctions if it is in theStandbystate but the total number of robots in theOperatingstate is greater than or equal tocoordinationThreshold[i].
If any robot malfunctions, the system is considered unstable. Return the total number of distinct valid configurations where no robot malfunctions.
A configuration is an assignment of each of the n robots to either Operating or Standby. A configuration is considered valid if no robot malfunctions under that arrangement. Two configurations are distinct if at least one robot is in a different state.
Function
countStableConfigurations(coordinationThreshold: int[]) → intExamples
Example 1
coordinationThreshold = [6, 0, 3, 3, 6, 7, 2, 7]return = 3There are three valid ways to select robots to be in the Operating state. Two of them are:
- Only the robot at index
1isOperating. Its threshold is0, so it has at least0other operating robots. All other robots remain inStandby, and their thresholds exceed the one operating robot. - Robots at indices
1,2,3, and6areOperating, with threshold values0,3,3, and2. Each operating robot has at least its threshold number of other operating robots, and every standby robot has fewer operating robots than its threshold.
So the total number of valid configurations is 3.
More Amazon Online Assessment questions
- Get Smallest Base SegmentOA · Seen Nov 2026
- Minimum Cost of Left and Right PropagationOA · Seen Nov 2026
- Minimum Grid InconvenienceOA · Seen Nov 2026
- Maximize K-Element AND with an Increment BudgetOA · Seen Nov 2026
- Maximize Shipment Order by Sorting One WindowOA · Seen Nov 2026
- Maximum Equal-Bit Pairs in a SubsequenceOA · Seen Nov 2026
- First Non-Repeating CharacterOA · ONSITE INTERVIEW · Seen Nov 2026
- Two SumOA · PHONE SCREEN · Seen Nov 2026
- Minimum Merge ConflictsOA · Seen Nov 2026
- Shopping Cart BillingOA · Seen Nov 2026
Similar questions at other companies
- Sum of Pipeline Response TimesBloomberg LP · OABloomberg LP interview questions
- Increasing-Value Triplets Under a ThresholdIBM · OAIBM interview questions
- Product of Subset MaximaArcesium · OAArcesium interview questions
- Count Triplets With Sum at Most TargetGoogle · ONSITE INTERVIEWGoogle interview questions
- Reduce Array Size to At Most HalfMicrosoft · ONSITE INTERVIEWMicrosoft interview questions
- Partition into Equal-Sum GroupsPalo Alto Networks · ONSITE INTERVIEWPalo Alto Networks interview questions
- Count Overlapping Square PairsRamp · OARamp interview questions
- Capping Portfolio WeightsCapstone Investment Advisors · OA
- Find Valid SET Card TriplesSnowflake · OA · PHONE SCREENSnowflake interview questions
- Largest Team Where Every Pair OverlapsWalmart · OAWalmart interview questions
Amazon interview experiences
- Amazon SWE OA with AI Coding: 1 Experience
- Amazon SWE Intern Phone Screen Interview Experience: 1 Experience
- Amazon New Grad SDE I OA and Virtual Onsite: 1 Experience
- Amazon BIE Intern SQL and Interview Questions: 17 Experiences
- Amazon Experienced SWE AI-Assisted Debugging OA: 1 Experience
- Amazon SDE II (L5) Interview Questions: 5 Experiences