int[] arr = {2,1,2,5,2,3,5,3,2};
return the max number which is moslty occur and how many time that occurr in array . he tells me don't use hashmap or any data structure . or you can use loops . so i was thinking about complexity as well . if take 2 loops and try to implement that logic . the complexity will be n2 , so i avoided , and i i go with below approch .
but interview was in rush . he didn't uderstand what i did here . i was explaining but he don't want to even listen to me what is my logic behind . i told him insead of MAX_Integer, i will find the max value and create the array with that size to solve this problem , but he didn't listen to me .