LinkedIn Software Engineer Phone Screen: Weighted GetRandom Variation
Question Details
Hi, got an interesting question in Phone screen interview. Hopefully it will help someone. Trying to share the idea of the question. the actual language might be different in the question. Linked has
Full Details
Hi, got an interesting question in Phone screen interview. Hopefully it will help someone. Trying to share the idea of the question. the actual language might be different in the question. Linked has organised a fair. Based on some good action a linkedin member will be given 1 ticket. Based on some other bad action, a ticket will be taken from the member. Implement three methods addTicket(memberId) , removeTicket(memberId) and getRandom(). getRandom() should pick a member with weighted probability based on number of tickets a memeber has.
Example if a member has 5 tickets and another one has 1 ticket, then the probability of the member with 5 tickets is higher than the one with 1 ticket. Its a variation of Insert Delete getRandom question. Hope it helps.
About This Question
This is a reported interview question from a linkedin interview for a swe role during the phone screen round reported in 2026.
It covers the following topics: Probability Stats .