Tournament Winner Time : O(n) Space : O(team) 123456789101112131415161718#include <vector>using namespace std;string tournamentWinner(vector<vector<string>> competitions, vector<int> results) { unordered_map<string, int> mp; string res = ""; int ma = 0; for(int i = 0; i < results.size(); i++) { string winner = competitions[i][abs(results[i] - 1)]; if(ma < (mp[winner] += 3)) { ma = mp[winner]; res = winner; } } return res;}