Scala solution: reduceLeft function reduceLeft function can be used to get min and max values of an Array[Int] scala>