Files
2022-05-20 10:07:19 -07:00

15 lines
236 B
Go

package main
func isPrefixOfGood2(xs, ys []int) bool {
if len(ys) == 0 { // OK: not inside the loop
return len(xs) == 0
}
for i := 0; i < len(xs); i++ {
if len(ys) <= i || xs[i] != ys[i] {
return false
}
}
return true
}