diff --git a/E_1688_CountofMatchesinTournament.java b/E_1688_CountofMatchesinTournament.java new file mode 100644 index 0000000..dcbcdaf --- /dev/null +++ b/E_1688_CountofMatchesinTournament.java @@ -0,0 +1,17 @@ +public class Solution { + public int numberOfMatches(int n) { + int matches = 0; + while(n!=1) { + if (n % 2 == 0) { //çiftse + n = n / 2; + matches += n; + + } else { //tekse + n = ((n - 1) / 2); + matches += n; + n = n + 1; + } + } + return matches; + } +} \ No newline at end of file