My simple code to solve it, c 4ms


  • -1
    Y

    this is my code ...

    int findMin(int num[], int n) {
    int i = 0;

    if(n == 1)
        return num[0];
    
    for(i = 1; i <= n - 1; i ++){
        if(num[i] < num[i - 1])
            return num[i];
    }
    
    return num[0];
    

    }


Log in to reply
 

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