March 2020
Intermediate to advanced
406 pages
8h 39m
English
We can find the smallest and largest values within a dataset using the min_element and max_element algorithms respectively. We can implement min_element and max_element in Go using a simple iterator:
package mainimport "fmt"func findMinInt(a []int) int { var minInt int = a[0] for _, i := range a { if minInt > i { minInt = i } } return minInt}
func findMaxInt(b []int) int { var max int = b[0] for _, i := range b { if max < i { max = i } } return max}
func ...
Read now
Unlock full access