python 5 liners (possible cheating?)


  • 0
    F

    Why reinventing the wheel? Or is this considered cheating to use existing index method:

    class Solution(object):
        def search(self, nums, target):
            try:
                return nums.index(target)
            except:
                return -1
    

Log in to reply
 

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.