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.

23 lines
263 B

# 列表查找
* 介绍
* **列表查找**(线性查找):从列表中查找指定元素
* **代码**
```go
3 years ago
func main() {
fmt.Println(listQuery(13))
}
3 years ago
func listQuery(k int) int {
for i := 0; i < 20; i++ {
if i == k {
return i
}
}
return -1
}
```