image_2021-11-01_15-39-39.png
24 KB
#N1688. Count of Matches in Tournament
problem link=>https://leetcode.com/problems/count-of-matches-in-tournament/
#solution
problem link=>https://leetcode.com/problems/count-of-matches-in-tournament/
#solution
class Solution {
public int numberOfMatches(int n) {
int matches=0;
while(n>1){
matches+=n/2;
n-=n/2;
}
return matches;
}
}