forked from go/golangs_learn
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
263 B
263 B
列表查找
- 介绍
- 列表查找(线性查找):从列表中查找指定元素
- 代码
func main() {
fmt.Println(listQuery(13))
}
func listQuery(k int) int {
for i := 0; i < 20; i++ {
if i == k {
return i
}
}
return -1
}