You are viewing a single comment's thread. Return to all comments →
func findMax(arr *[]int32) int { max := (*arr)[0] index := 0 for i:=1; i< len(*arr); i++ { if max < (*arr)[i]{ max = (*arr)[i] index = i } } return index } func gamingArray(arr []int32) string { i := 0 for 0 < len(arr) { index := findMax(&arr) arr = arr[:index] i++ } if i%2 == 0 { return "ANDY" } return "BOB" }
Seems like cookies are disabled on this browser, please enable them to open this website
I agree to HackerRank's Terms of Service and Privacy Policy.
Gaming Array
You are viewing a single comment's thread. Return to all comments →