package leetcode;

import java.util.Arrays;

/**
 * https://leetcode.com/problems/finding-the-users-active-minutes/
 */
public class Problem1817 {
    public int[] findingUsersActiveMinutes(int[][] logs, int k) {
        int[] answer = new int[k];
        for (int[] log : logs) {
            // TODO
        }
        return answer;
    }

    public static void main(String[] args) {
        Problem1817 prob = new Problem1817();
        System.out.println(Arrays.toString(prob.findingUsersActiveMinutes(
            new int[][]{{0,5},{1,2},{0,2},{0,5},{1,3}}, 5
        ))); // [0,2,0,0,0]
        System.out.println(Arrays.toString(prob.findingUsersActiveMinutes(
            new int[][]{{1,1},{2,2},{2,3}}, 4
        ))); // [1,1,0,0]
    }
}

@@ -29,22 +29,93 @@
 va.util.
-Arrays
+HashMap;%0Aimport java.util.HashSet;%0Aimport java.util.Map;%0Aimport java.util.Set
 ;%0A%0A/**%0A 
@@ -312,16 +312,95 @@
 int%5Bk%5D;%0A
+        Map%3C/* user */ Integer, Set%3C/* UAM */ Integer%3E%3E map = new HashMap%3C%3E();%0A
         
@@ -440,221 +440,146 @@
     
-// TODO%0A  
+int user = log%5B0%5D;%0A
       
-%7D%0A
       
-  return answer
+int time = log%5B1%5D
 ;%0A    
-%7D%0A%0A
+ 
     
-public static void main(String%5B%5D args) %7B%0A        Problem1817 prob = new Problem1817();%0A        System.out.println(Arrays.toString(prob.findingUsersActiveMinutes(
+   map.putIfAbsent(user, new HashSet%3C%3E());%0A            map.get(user).add(time);
 %0A   
@@ -587,232 +587,134 @@
     
+%7D%0A
     
-new int%5B%5D%5B%5D%7B%7B0,5%7D,%7B1,2%7D,%7B0,2%7D,%7B0,5%7D,%7B1,3%7D%7D, 5%0A        ))); // %5B0,2,0,0,0%5D%0A        System.out.println(Arrays.toString(prob.findingUsersActiveMinutes(%0A            new int%5B%5D%5B%5D%7B%7B1,1%7D,%7B2,2%7D,%7B2,3%7D%7D, 4%0A        ))); // %5B1,1,0,0%5D
+    for (Set%3CInteger%3E uamSet : map.values()) %7B%0A            answer%5BuamSet.size() - 1%5D++;%0A        %7D%0A        return answer;
 %0A   

Solve problem 1817