mirror of
https://github.com/duke-git/lancet.git
synced 2025-09-27 03:45:58 +08:00
Todo: add todo for playground demo of function
This commit is contained in:
@@ -10,6 +10,7 @@ import "github.com/duke-git/lancet/v2/lancetconstraints"
|
||||
|
||||
// LinearSearch return the index of target in slice base on equal function.
|
||||
// If not found return -1
|
||||
// Play: Todo
|
||||
func LinearSearch[T any](slice []T, target T, equal func(a, b T) bool) int {
|
||||
for i, v := range slice {
|
||||
if equal(v, target) {
|
||||
|
Reference in New Issue
Block a user