Replace every elements in the array by its frequency in the array
Given an array of integers, replace every element by its frequency in the array. Examples: Input : arr[] = { 1, 2, 5, 2, 2, 5 } Output : 1 3 2 3 3 2 Input : arr[] = { 4 5 4 5 6 6 6 } Output : 2 2 2 2 3 3 3 Approach: Take a hash map, which will store the frequency of all the elements in the array.Now