# 1817. Finding the Users Active Minutes ###### tags: `Leetcode` `Medium` Link: https://leetcode.com/problems/finding-the-users-active-minutes/description/ ## Code ```java= class Solution { public int[] findingUsersActiveMinutes(int[][] logs, int k) { int[] ans = new int[k]; Map<Integer, Set<Integer>> map = new HashMap<>(); for(int[] log:logs){ if(!map.containsKey(log[0])) map.put(log[0], new HashSet<>()); map.get(log[0]).add(log[1]); } for(int key:map.keySet()){ if(map.get(key).size()<=k){ ans[map.get(key).size()-1]++; } } return ans; } } ```
×
Sign in
Email
Password
Forgot password
or
By clicking below, you agree to our
terms of service
.
Sign in via Facebook
Sign in via Twitter
Sign in via GitHub
Sign in via Dropbox
Sign in with Wallet
Wallet (
)
Connect another wallet
New to HackMD?
Sign up