We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 6273a74 commit a4b2912Copy full SHA for a4b2912
first_occurrence.py
@@ -0,0 +1,10 @@
1
+def first_occurrence(array: list[int], target: int) -> int:
2
+ pointer = 0
3
+
4
+ while pointer < len(array):
5
+ if array[pointer] == target:
6
+ return pointer
7
+ pointer += 1
8
9
+ return -1
10
0 commit comments