Simple java, recursive

  • 2
     public int findMin(int[] nums) {
            return findMin(nums, 0, nums.length-1);
        public int findMin(int[] nums, int l, int h) {
            if (l >= h) {
                return nums[l];
            int mid = (h+l)/2;
            if (nums[mid] > nums[h]) {
                return findMin(nums, mid+1, h);
            return findMin(nums, l, mid);

Log in to reply

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