Anyone know why the return num of my code is None?

  • 0

    I write a python code like following, but the output is None. Anyone know the reason?

    class Solution:

    # @param {integer[]} nums
    # @return {integer}
    def findMin(self, nums):
        if len(nums) == 1 or nums[0] < nums[-1]:
            return nums[0]
        if len(nums) == 2:
            return min(nums)
        mid = len(nums)/2
        if nums[mid] < nums[-1]:

    s = Solution()
    print s.findMin([3,1,2])

Log in to reply

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