Shouldn’t the time complexity for the hashing approach be O(n + m), where “n” is the size of the array and “m” is the size of the hash map?
The size of the hash map is only going to be the same as the size of the array, "n,"if there are no duplicates (best case), i.e. you can say that the overall time complexity is O(n). In any other case, the size of the hash map will be less than that of the array because of the nature of a frequency map, therefore the time complexity should be O(n + m).