Max and min in an array of Float in Swift

后端 未结 5 1006
悲哀的现实
悲哀的现实 2021-01-14 17:57

According to this answer, to obtain the maximum of an array we can do:

let nums = [1, 6, 3, 9, 4, 6];
let numMax = nums.reduce(Int.min, { max($0, $1) })
         


        
5条回答
提交回复
热议问题