JAVA_LeetCode 1688_Count of Matches in Tournament 풀이 class Solution { public int numberOfMatches(int n) { // 홀/짝수에 맞춰서 반복해준다. int cnt = 0; while(n > 1){ if(n%2==0){ cnt += n / 2; n = n / 2; }else{ cnt += (n - 1) / 2; n = (n - 1) / 2 + 1; } } return cnt; } } * 출처 https://leetcode.com/problems/count-of-matches-in-tournament/...
JAVA_LeetCode 1688_Count of Matches in Tournament에 대한 요약내용입니다.
자세한 내용은 아래에 원문링크를 확인해주시기 바랍니다.