G2A Many GEOs
SHARE
TWEET

oi gatinha

a guest Mar 28th, 2020 87 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. class Solution {
  2. public:
  3.     int numTeams(vector<int>& rating) {
  4.         int n = rating.size();
  5.         int sol = 0;
  6.         for(int i = 0; i < n-2; i++){
  7.             for(int j = i+1; j < n-1; j++){
  8.                 for(int k = j+1; k < n; k++){
  9.                     if(rating[i] < rating[j] && rating[j] < rating[k]){
  10.                         sol++;
  11.                     }
  12.                     if(rating[i] > rating[j] && rating[j] > rating[k]){
  13.                         sol++;
  14.                     }
  15.                 }
  16.             }
  17.         }  
  18.         return sol;
  19.     }
  20. };
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top