My code in Python went wrong ,can anybody tell me where goes wrong?


  • 0
    C
    class Solution:
    # @param num, a list of integer
    # @return an integer
    def findMin(self, num):
        a = num[0];
        if num[0]<=num[len(num)-1]:
            return num[0];
        else:
            for i in range(0,len(num)-1):
                if num[i] >=a:
                    del num[i];
            return num[0];

  • 0
    B

    you only keep items less than a or num[0],


Log in to reply
 

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