The hotel's guests map has each guest's room, and leaving lists who checks out today. Write CheckOut(guests, leaving) to remove them from guests and return how many are still staying. leaving may name someone who isn't a guest; deleting a missing key is fine.
CheckOut(map[string]int{"Amy": 101, "Bo": 102, "Cy": 103}, []string{"Bo"})→2CheckOut(map[string]int{"Amy": 101}, []string{"Amy"})→0func CheckOut(guests map[string]int, leaving []string) intpackage main
func CheckOut(guests map[string]int, leaving []string) int {
for _, name := range leaving {
// your code here: remove name from guests
}
return len(guests)
}
Run tries the examples. When they look right, Submit.