Sobes.tech
Intern — Senior

Determining the number of identical numbers in a list

livecode

Task condition

The method receives a list of integers and forms a Map, where the key is a number from the list, and the value is how many times it appears in the data.

Example input data: [1, 2, 3, 4, 2, 3, 4, 100] Expected result: {2=2, 3=2, 4=2}

public class Solution {
    public Map<Integer, Integer> calculateRepeats(List<Integer> input) {
        // TODO
    }
}