Created
April 14, 2024 02:09
-
-
Save rphuber/060c9f1a11e7dde4baffa7574e82716c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func linearSearch(slice []int, target int) (index, numTests int) { | |
for idx, val := range slice { | |
if val == target { | |
return idx, idx + 1 | |
} | |
} | |
return -1, len(slice) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment