A past puzzle — fully playable. 4 attempts, hints on wrong guesses.
stdle-137.go
1packagemain
2
3import"fmt"
4
5funcmain(){
6s:=[]int{1,2,3,4}
7t:=s[1:3]
8t[0]=99
9fmt.Println(s)
10}
Slices
Answer & explanation
Console output
[1 99 3 4]
Why
Slicing does not copy elements; t shares the backing array with s. The expression t[0] refers to the same memory cell as s[1], so assigning 99 through t is visible when you print s. To get an independent slice you must copy() or append into a fresh slice.