Generation

generate functionSun, 13 Nov 2022

Replace top 5 integers in array with 0

func replace_top_five(arr []int) []int { for i, v := range arr { if i < 5 { arr[i] = 0 } } return arr }

Questions about programming?Chat with your personal AI assistant