Initial commit: Go SRE interview exercises
Includes solved 02-worker-pool and 09-safe-counter (mutex, atomic, sharded). Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01GbnJj9ZqEx9nUvzkjdwfMq
This commit is contained in:
@@ -0,0 +1,17 @@
|
||||
// PREDICT both printed slices. Explain the difference between the two appends.
|
||||
package main
|
||||
|
||||
import "fmt"
|
||||
|
||||
func main() {
|
||||
a := []int{1, 2, 3, 4}
|
||||
|
||||
b := a[:2]
|
||||
b = append(b, 99)
|
||||
fmt.Println("after append to a[:2] ->", a)
|
||||
|
||||
a = []int{1, 2, 3, 4}
|
||||
c := a[:2:2]
|
||||
c = append(c, 100)
|
||||
fmt.Println("after append to a[:2:2] ->", a)
|
||||
}
|
||||
Reference in New Issue
Block a user