Find the Median

  • + 0 comments
        public static int findMedian(List<int> arr)
        {
            var middleElementIndex = Math.Ceiling(arr.Count / 2.0) - 1;
            
            arr.Sort();
            
            return arr[(int)middleElementIndex];
        }