File tree Expand file tree Collapse file tree 2 files changed +24
-1
lines changed Expand file tree Collapse file tree 2 files changed +24
-1
lines changed Original file line number Diff line number Diff line change 1- # 1,475 LeetCode solutions in JavaScript
1+ # 1,476 LeetCode solutions in JavaScript
22
33[ https://leetcodejavascript.com ] ( https://leetcodejavascript.com )
44
130013001685|[ Sum of Absolute Differences in a Sorted Array] ( ./solutions/1685-sum-of-absolute-differences-in-a-sorted-array.js ) |Medium|
130113011686|[ Stone Game VI] ( ./solutions/1686-stone-game-vi.js ) |Medium|
130213021687|[ Delivering Boxes from Storage to Ports] ( ./solutions/1687-delivering-boxes-from-storage-to-ports.js ) |Hard|
1303+ 1688|[ Count of Matches in Tournament] ( ./solutions/1688-count-of-matches-in-tournament.js ) |Easy|
130313041716|[ Calculate Money in Leetcode Bank] ( ./solutions/1716-calculate-money-in-leetcode-bank.js ) |Easy|
130413051718|[ Construct the Lexicographically Largest Valid Sequence] ( ./solutions/1718-construct-the-lexicographically-largest-valid-sequence.js ) |Medium|
130513061726|[ Tuple with Same Product] ( ./solutions/1726-tuple-with-same-product.js ) |Medium|
Original file line number Diff line number Diff line change 1+ /**
2+ * 1688. Count of Matches in Tournament
3+ * https://leetcode.com/problems/count-of-matches-in-tournament/
4+ * Difficulty: Easy
5+ *
6+ * You are given an integer n, the number of teams in a tournament that has strange rules:
7+ * - If the current number of teams is even, each team gets paired with another team. A total
8+ * of n / 2 matches are played, and n / 2 teams advance to the next round.
9+ * - If the current number of teams is odd, one team randomly advances in the tournament, and
10+ * the rest gets paired. A total of (n - 1) / 2 matches are played, and (n - 1) / 2 + 1 teams
11+ * advance to the next round.
12+ *
13+ * Return the number of matches played in the tournament until a winner is decided.
14+ */
15+
16+ /**
17+ * @param {number } n
18+ * @return {number }
19+ */
20+ var numberOfMatches = function ( n ) {
21+ return n - 1 ;
22+ } ;
You can’t perform that action at this time.
0 commit comments