Bloomberg telephone screen.

Posted
6 Apr 2025
318 reads

Summary

I had a telephone screen with Bloomberg where I was asked to design a data structure for a horse race with specific add and get methods.

How it went

Design data structure for a horse race, where we will have two methods.

add(string horseName, int checkpoint)

Updates the position of the horse. This method will be called for all the checkpoints horse crosses. Checkpoints are in increasing order.

get()

Return name of the horses, one with the highest checkpoint first When two horses are at the same checkpoint, print horses in the order which reached that checkpoint first.

Example.

Input.

["HorseRace","add","add","get","add","get","add","get"]
[[],["A",1],["B",1],[],["C",1],[],["B",2],[]]

Output.

[null,null,null,["A","B"],null,["A","B","C"],null,["B","A","C"]]

Questions asked (1)

  1. 01

    Design Horse Race Data Structure

    Data Structures & Algorithms

    Design data structure for a horse race, where we will have two methods.

    add(string horseName, int checkpoint)

    Updates the position of the horse. This method will be called for all the checkpoints horse crosses. Checkpoints are in increasing order.

    get()

    Return name of the horses, one with the highest checkpoint first When two horses are at the same checkpoint, print horses in the order which reached that checkpoint first.

    Example.

    Input.

    ["HorseRace","add","add","get","add","get","add","get"]
    [[],["A",1],["B",1],[],["C",1],[],["B",2],[]]
    

    Output.

    [null,null,null,["A","B"],null,["A","B","C"],null,["B","A","C"]]
    

Know someone preparing? Send it to them:WhatsAppLinkedInX

Interviewed at Bloomberg recently?

Write up your rounds while you still remember the questions. It helps the next person more than you would think.

Share your experience
Discussion 0

Questions for the author, or how your own interview compared.

Join the discussion

Sign in with Google to comment or ask the author a question.

No comments yet

Be the first to share your thoughts and start the discussion!