Answer: 1. MUDREX On-Campus OA (2023) | Count of Matches in Tournament

Answer · Posted Jun 2026

Approach Every match eliminates exactly one team. Starting with n teams and ending with 1 winner means exactly n − 1 teams are eliminated. Therefore, the answer is always: Total Matches = n - 1 Java Solution class SolutionSim { public int numberOfMatches(int n) { int matches = 0; while (n > 1) { matches += n / 2; n = n / 2 + n % 2; } return matches; } } Time Complexity Optimal: O(1) Simulation: O(log n) ...

The full answer & interview discussion are available to premium members.

Log in Create a free account