There's a queue outside the bakery; queue holds the names from front to back. Write PlaceInLine(queue, name) to return where name is in line (the front is 1). If they aren't in the queue, return 0.
PlaceInLine([]string{"Ana", "Ben", "Cai"}, "Ben")→2PlaceInLine([]string{"Ana"}, "Zoe")→0func PlaceInLine(queue []string, name string) intpackage main
func PlaceInLine(queue []string, name string) int {
for i, person := range queue {
// your code here: is this the person? return their place in line
}
return 0
}
Run tries the examples. When they look right, Submit.