Java 7 lines accepted solution


  • 0
    F

    public class Solution {
    public int findMin(int[] nums) {
    int pos=0;
    for(int i=0;i<nums.length-1;i++){
    if(nums[i]>nums[i+1]){
    pos=i+1;
    break;
    }
    }
    return nums[pos];
    }
    }


Log in to reply
 

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