Ruby Solution: Complexity Sol1- O(n logn) and Sol2-O(n)


#1

Solution1: complexity- ruby sort algo complexity which is QuickSort
sorted_array = a.sort
min= sorted_array.first
max=sorted_array.last
min+max

Soution2: complexity: O(n)
min=a.first
max=a.first
(1…a.length-1).each do |i|
if a[i]>max
max=a[i]
end
if a[i]<min
min=a[i]
end
end
min+max