Skip to content

Commit 21bfd72

Browse files
authored
Create smallest-index-with-equal-value.py
1 parent f2a2ded commit 21bfd72

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# Time: O(n)
2+
# Space: O(1)
3+
4+
class Solution(object):
5+
def smallestEqual(self, nums):
6+
"""
7+
:type nums: List[int]
8+
:rtype: int
9+
"""
10+
return next((i for i, x in enumerate(nums) if i%10 == x), -1)

0 commit comments

Comments
 (0)