Skip to content

旋转数组的最小值,下面算法和lz的一样? #2

@Cherrymelon

Description

@Cherrymelon

说实话我没看明白lz写的,但是测试了下我的,居然一样

class Solution:
    def minNumberInRotateArray(self, rotateArray):
        if len(rotateArray)==0:
            return 0
        head =0
        rear = len(rotateArray)-1
        while rotateArray[head]<=rotateArray[head+1]:
            head+=1
        return rotateArray[head+1]

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions