nikunjsoni

1817

Apr 4th, 2021
72
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. class Solution {
  2. public:
  3.     vector<int> findingUsersActiveMinutes(vector<vector<int>>& logs, int k) {
  4.         unordered_map<int, set<int>> m;
  5.         for(int i=0; i<logs.size(); i++){
  6.             m[logs[i][0]].insert(logs[i][1]);
  7.         }
  8.         vector<int> ans(k, 0);
  9.         for(auto s: m){
  10.             int sz = s.second.size();
  11.             ans[sz-1]++;
  12.         }
  13.         return ans;
  14.     }
  15. };
RAW Paste Data