462. Minimum Moves to Equal Array Elements II
Approach 1: Reach Median
The middle most value is the median and is at the shortest distance to reach to. Thus we can simply sort the array, find the median and evaluate the number of moves required
Time Complexity: O(NlogN)[due to sorting]
Space Complexity: O(1)
Last updated