Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- bool check(int x) {
- int num = 0;
- while (x != 0) {
- num += (x % 2);
- x /= 2;
- }
- if (num % 2 == 1) {
- return true;
- } else {
- return false;
- }
- }
- long thePerfectTeam(vector<int> employeeRating) {
- long res = 0;
- int n = (int) employeeRating.size();
- for (int i = 0; i < n; i++) {
- for (int j = i + 1; j < n; j++) {
- if (check(employeeRating[i] ^ employeeRating[j])) {
- res++;
- }
- }
- }
- return res;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement