FastPrepTournament Rounds by Rank
Problems/Tournament Rounds by Rank

Tournament Rounds by Rank

Uber logoUber● EasyFULLTIMEPHONE SCREEN

Updated Sep 2026

QuestionFunctionExamplesConstraints

Problem statement

You are given an array ranks representing players in tournament order. A smaller number means a stronger rank.

In each round, adjacent players compete: indices 0 and 1, indices 2 and 3, and so on. The player with the smaller rank number advances to the next round. If a round has an odd number of players, the last player advances automatically.

Return the list of rounds after each elimination round. Each inner array should contain the ranks that advanced from that round, in order. Continue until one player remains.

Function

simulateTournamentRounds(ranks: int[]) → int[][]

Complete the function simulateTournamentRounds in the editor.

simulateTournamentRounds has the following parameter:

  1. int ranks[]: player ranks in the initial bracket order

Returns int[][]: the advancing ranks after each round

Examples

Example 1

ranks = [1, 2, 3, 4, 5, 6, 7, 8]return = [[1, 3, 5, 7], [1, 5], [1]]

In the first round, the winners are 1, 3, 5, and 7. Then 1 and 5 advance. Finally, 1 wins.

Example 2

ranks = [3, 1, 2]return = [[1, 2], [1]]

Player 1 beats player 3. Player 2 has no opponent in the first round and advances automatically.

Constraints

  • Rank values are distinct.
  • A smaller rank number represents a stronger player.
  • If a round has an odd number of players, the last player advances automatically.

More Uber Phone Screen questions

  • Worst-Performing Ads by CTR in a Campaign TreePHONE SCREEN · Seen Nov 2026
  • Earliest Time All Users Are ConnectedPHONE SCREEN · ONSITE INTERVIEW · Seen Oct 2026
  • Max Points on a LinePHONE SCREEN · Seen Oct 2026
  • Convex Function MinimizationPHONE SCREEN · Seen Oct 2026
  • Meeting Rooms IIPHONE SCREEN · Seen Oct 2026
  • Merge Meeting IntervalsPHONE SCREEN · Seen Oct 2026
  • Minimum Meeting Rooms with AssignmentsPHONE SCREEN · ONSITE INTERVIEW · Seen Oct 2026
  • Find Robots by Blocker DistancesPHONE SCREEN · Seen Oct 2026
  • Sliding-Window Rate LimiterPHONE SCREEN · Seen Oct 2026
  • Count Connected IslandsPHONE SCREEN · Seen Sep 2026

Similar questions at other companies

  • Lazy Filter over a GeneratorSquarepoint Capital · PHONE SCREENSquarepoint Capital interview questions
  • Automation Pipeline, Part 1: Single WorkerPlaid · PHONE SCREENPlaid interview questions
  • Search and Format ContactsAdyen · PHONE SCREENAdyen interview questions
  • Array-Backed Set Without Library CollectionsOde with Anthropic · PHONE SCREEN
  • Paginate Retained Conversation HistorySierra · PHONE SCREENSierra interview questions
  • Validate a Chess Bishop, Rook, or Queen MoveGlean · PHONE SCREENGlean interview questions
  • Count Distinct Underwriting PII ValuesAffirm · PHONE SCREEN · ONSITE INTERVIEWAffirm interview questions
  • Apply Affine Array TransformationsByteDance · PHONE SCREENByteDance interview questions
  • Match a Variadic Function SignatureConfluent · PHONE SCREENConfluent interview questions
  • Bounded IPv4 FilterAmazon · PHONE SCREEN
All Uber interview questionsSee Uber hiring insights
Saved
class Solution {
    public int[][] simulateTournamentRounds(int[] ranks) {
      // write your code here
    }
}
Checking account…