k.go 151 B

12345678910
  1. package kata
  2. import "sort"
  3. func TwoOldestAges(ages []int) [2]int {
  4. sort.Ints(ages)
  5. res := [2]int{}
  6. copy(res[:], ages[len(ages)-2:])
  7. return res
  8. }