class test: def search(self, nums: List[int], target: int) -> int: for i in nums: if i == target: return nums.index(target) else: return -1
why it's always return -1, whereas my condition is true
Aucun commentaire:
Enregistrer un commentaire