Given a file (which can be considered as a String with comma delimiter for the complexity of the question) of usernames and a value k, find top k usernames (with number of logins) who logged into the system the most.
For example –
User (String) = user1, user4, user2, user1, user3, user1, user2, user3
k (int) = 2
– Both user2 and user3 should be included since both has same number of logins
Write a java method to find the output with best time and space complexity.
[advanced_iframe securitykey=”undefined” src=”https://code.kodnest.com/” width=”100%” height=”600″]