FastPrepToken Ring
Problems/Token Ring

Token Ring

Bloomberg LP logoBloomberg LP● EasyFULLTIMEPHONE SCREEN

Updated Nov 2026

QuestionFunctionExamplesConstraints

Problem statement

Source note: A senior engineer's report on a Bloomberg phone screen in New York describes an object design task in place of the usual algorithm question. Several elements sit in a circle and pass around a single token. The element made first begins with it. A release hands it on to the following element, and past the final element it returns to the start. The report gives a short example with two elements and a C++ class template. The author says the task was explained badly and the round did not go well. No limits and no input or output format are given.

Our choices: the calls come as two lists, operations and elementIds, in one function, and the answer is one boolean for each hasToken. The report's example calls release on an element that does not hold the token, and the token still moves. So here a release moves the token one step from its holder, whichever element the call is made on. New elements join the ring after the last one. A run has up to 10,000 operations.

The judged task matches the report at about 80%.

Think of players sitting in a circle and passing one token. With three players, the token goes from player 1 to player 2, then to player 3, then back to player 1.

You get two arrays of the same length, operations and elementIds. Run them from first to last on a ring that starts with no elements. Elements are numbered 1, 2, 3, and so on, in the order they are created. In the ring, element 2 comes after element 1, and the element after the last one is element 1.

  • "create": add a new element at the end of the ring, after the most recently created element. elementIds[i] is 0 and is not used. The first element ever created holds the token. Elements created later do not take it.
  • "hasToken": elementIds[i] is an element number. Find out whether that element holds the token right now. Nothing changes.
  • "release": elementIds[i] is the number of the element this call is made on. The token moves from the element that holds it to the next element in the ring. The element the call is made on does not change this: even when it does not hold the token, the token still moves one step. If the ring has only one element, that element keeps the token.

Return a list with one boolean for each "hasToken", in the order they run: true when that element holds the token and false otherwise. If there is no "hasToken", return an empty list.

Function

runTokenRing(operations: String[], elementIds: int[]) → boolean[]

Examples

Example 1

operations = ["create","create","create","hasToken","release","hasToken","hasToken","release","release","hasToken"]elementIds = [0,0,0,1,1,1,2,2,3,1]return = [true,false,true,true]

Three elements are created. Element 1 holds the token, so the first hasToken answers true. The first release moves the token to element 2, so hasToken(1) is false and hasToken(2) is true. The next release moves it to element 3, and the one after that wraps around to element 1, so the last hasToken(1) is true. The answer is [true,false,true,true].

Example 2

operations = ["create","release","hasToken","create","release","hasToken","hasToken"]elementIds = [0,1,1,0,2,1,2]return = [true,false,true]

With one element, release passes the token to the next element, which is the same element, so hasToken(1) is true. After element 2 is created, release(2) is called on element 2, which does not hold the token. The token still moves from element 1 to the next element, which is element 2. So hasToken(1) is false and hasToken(2) is true. The answer is [true,false,true].

Example 3

operations = ["create","create","release","create","release","hasToken","release","hasToken","hasToken"]elementIds = [0,0,2,0,1,3,3,1,2]return = [true,true,false]

After one release the token is on element 2, the last element. Element 3 is then created and joins the ring after element 2. The next release moves the token from element 2 to element 3, not back to element 1, so hasToken(3) is true. One more release wraps around to element 1: hasToken(1) is true and hasToken(2) is false. The answer is [true,true,false].

Constraints

  • 1 <= operations.length <= 10000
  • elementIds.length == operations.length
  • Each operations[i] is "create", "hasToken" or "release".
  • 0 <= elementIds[i] <= 10000
  • For "create", elementIds[i] is 0. For "hasToken" and "release", elementIds[i] is the number of an element that has already been created, so the first operation is always "create".

More Bloomberg LP Phone Screen questions

  • N-ary Index-Path Encoder and DecoderPHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
  • Trapping Rain WaterPHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
  • Word SearchOA · PHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
  • Fewest Coins CombinationPHONE SCREEN · Seen Nov 2026
  • Recommend Films from Viewers Who Watched Everything You DidPHONE SCREEN · Seen Nov 2026
  • Track New Values in Sorted OrderPHONE SCREEN · Seen Nov 2026
  • Design Browser HistoryPHONE SCREEN · ONSITE INTERVIEW · Seen Oct 2026
  • Mutable Stock Price Top KPHONE SCREEN · ONSITE INTERVIEW · Seen Oct 2026
  • Sparse Vector and Matrix OperationsPHONE SCREEN · Seen Oct 2026
  • Add Two Numbers IIPHONE SCREEN · ONSITE INTERVIEW · Seen Oct 2026

Similar questions at other companies

  • Linked List Add and Remove OperationsAdobe · PHONE SCREENAdobe interview questions
  • LRU Cache for Query ResultsAmazon · PHONE SCREEN · ONSITE INTERVIEW
  • LRU CacheServiceNow · PHONE SCREEN · ONSITE INTERVIEWServiceNow interview questions
  • LRU Key-Value Cache OperationsCohesity · PHONE SCREEN
  • Least Recently Used CacheMicrosoft · OA · PHONE SCREEN · ONSITE INTERVIEWMicrosoft interview questions
  • LRU CacheApple · PHONE SCREEN · ONSITE INTERVIEWApple interview questions
  • Checkpointed Dynamic SequenceOpenAI · PHONE SCREENOpenAI interview questions
  • Least Recently Used CacheByteDance · PHONE SCREEN · ONSITE INTERVIEWByteDance interview questions
  • LRU CacheCoupang · PHONE SCREEN
  • LRU CacheBlinkit · PHONE SCREENBlinkit interview questions

Interview reports that mention this question

  • Bloomberg Experienced Design & More: 126 Questions (Part 2 of 2)

Bloomberg LP interview experiences

  • Bloomberg AI-Assisted Coding Round, All Levels: 14 Experiences
  • Bloomberg SWE Intern Interview Questions: 68 Questions
  • Bloomberg Interview Questions, Level Not Reported: 65 Questions
  • Bloomberg Experienced SWE Interviews: 167 Questions (Part 1 of 2)
  • Bloomberg New Grad Coding Questions: 121 Questions (Part 2 of 2)
All Bloomberg LP interview questionsSee Bloomberg LP hiring insights
Saved
class Solution {
    public boolean[] runTokenRing(String[] operations, int[] elementIds) {
        // Write your code here.
    }
}
Checking account…