conventions.io

Tech Challenge

2026-10-14

🦫

Daily Tech Challenge

Go

medium
Question 1 of 5

What does this Go program print, given how maps.Copy (Go 1.21+) handles a key that already exists in the destination map?

Example
package main

import (
	"fmt"
	"maps"
)

func main() {
	dst := map[string]int{"a": 1, "b": 2}
	src := map[string]int{"b": 20, "c": 30}
	maps.Copy(dst, src)
	fmt.Println(len(dst), dst["a"], dst["b"], dst["c"])
}

Wednesday, October 14, 2026 · A new challenge drops every day