ByteDance coding round
ByteDance · Question · Posted Oct 2021
Let's play a card game. We have a deck with n cards, each card is labelled from 1 to n in that order from top to bottom. For each round, we shuffle/take k-1 cards from the top to the bottom. Then remove the the top card. We will continue this until there is only one card left. You have to bet what the number on the card is. Example 1: Input: n = 5, k = 2 Output: ...
The full answer & interview discussion are available to premium members.
Log in Create a free account