A past puzzle — fully playable. 4 attempts, hints on wrong guesses.
stdle-180.go
1packagemain
2
3import"fmt"
4
5funcmain(){
6s:=[]int{1,2,3,4,5}
7t:=s[2:]
8t[1]=0
9fmt.Println(s)
10}
Slices
Answer & explanation
Console output
[1 2 3 0 5]
Why
A sub-slice shares the backing array and its index 0 maps to the start offset. Here t begins at s[2], so t[1] is s[3]. Writing 0 through t changes the shared array, and printing s shows the change at index 3.