FastPrepATM Queue Exit Order
Problems/ATM Queue Exit Order

ATM Queue Exit Order

Salesforce logoSalesforce● MediumPHONE SCREEN

Updated Nov 2026

QuestionFunctionExamples

Problem statement

There are n people standing in a queue, numbered from 1 to n. Person i wants to withdraw amounts[i] units of money.

The ATM allows at most k units per transaction. If a person still has money left after a transaction, they move to the end of the queue. Otherwise, they leave the queue.

Return the order in which people leave the queue.

Function

atmQueueOrder(amounts: int[], k: int) → int[]

Examples

Example 1

amounts = [2,3,1,4,2]k = 2return = [1,3,5,2,4]

People 1, 3, and 5 finish during their first turn. Person 2 finishes before person 4 on their later turns.

More Salesforce Phone Screen questions

  • Detect a Cycle in a Linked ListPHONE SCREEN · Seen Oct 2026
  • Find Rows Common to Two TablesPHONE SCREEN · Seen Oct 2026
  • Merge Two Sorted Linked ListsPHONE SCREEN · Seen Oct 2026
  • Minimum Window of Required WordsPHONE SCREEN · Seen Aug 2026
  • Permutations of Unique CharactersPHONE SCREEN · Seen Aug 2026
  • Minimum Window SubstringPHONE SCREEN · Seen Aug 2026
  • Optimal Account BalancingPHONE SCREEN · Seen Jul 2026
  • Longest Increasing SubsequencePHONE SCREEN · Seen Jul 2026
  • Maximal SquarePHONE SCREEN · Seen Jul 2026
  • Good Ways to Split an ArrayPHONE SCREEN · Seen May 2026

Similar questions at other companies

  • Constant-Time Weighted Pick with an Alias TableEtched · PHONE SCREEN
  • VIP and Regular Service SchedulerIntuit · PHONE SCREENIntuit interview questions
  • Callback Signal RegistryCandid Health · PHONE SCREEN
  • Implement a FIFO QueueByteDance · PHONE SCREENByteDance interview questions
  • Sliding-Window API Rate LimiterPatreon · PHONE SCREEN · ONSITE INTERVIEWPatreon interview questions
  • High-Card Pot GameAffirm · PHONE SCREENAffirm interview questions
  • Stateful Paginated Fetch NLyft · PHONE SCREENLyft interview questions
  • Batch API Requests with Retry DelaysDecagon · PHONE SCREENDecagon interview questions
  • Music Player Operation SequenceAtlassian · PHONE SCREENAtlassian interview questions
  • Rate Limiter Sliding Window With Per-Entity LimitsRoblox · PHONE SCREEN · ONSITE INTERVIEWRoblox interview questions

Salesforce interview experiences

  • Salesforce Infrastructure SWE OA and Onsite: 1 Experience
  • Salesforce Experienced Backend SWE First Round: 1 Experience
All Salesforce interview questionsSee Salesforce hiring insights
Saved
class Solution {
    public int[] atmQueueOrder(int[] amounts, int k) {
      // write your code here
    }
}
Checking account…