Mohamed Sanaulla wrote:Did you try running the program? let us know the results and if it holds good for different inputs.
Integer[] a = {1,2,3,3,0,1,5,1,1};
run:
1 repeats : 4
3 repeats : 2
Integer[] a = {1,2,3,4,0,1,5,2,1};
run:
1 repeats : 3
2 repeats : 2
Yes,it is working. Is it's efficiency O(n)??
Is containsKey(x) function not increasing the complexity??