Advertisement
nikunjsoni

1753

May 25th, 2021
106
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.44 KB | None | 0 0
  1. class Solution {
  2. public:
  3.     int maximumScore(int a, int b, int c) {
  4.         return min((a+b+c)/2, (a+b+c)-max({a, b, c}));
  5.     }
  6. };
  7.  
  8. ----------------
  9.  
  10. class Solution {
  11. public:
  12.     int maximumScore(int a, int b, int c) {
  13.         if (a > b)
  14.             return maximumScore(b, a, c);
  15.         if (b > c)
  16.             return maximumScore(a, c, b);
  17.         return (!b && !a) ? 0 : 1 + ((b>a) ? maximumScore(a, b-1, c-1) : maximumScore(a-1, b, c-1));
  18.     }
  19. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement