My Java solution from another angle


  • 0
    H
    public class Solution {
        public int findMin(int[] nums) {
            return findMin(nums, 0, nums.length - 1);
        }
        private int findMin(int[] nums, int start, int end) {
            if (start == end) {
                return nums[start];
            }
            int mid = (start + end) / 2;
            return Math.min(findMin(nums, start, mid), findMin(nums, mid + 1, end));
        }
    }

  • 2

    Don't you think this is rather silly? You're just walking the whole array, ignoring its structure, and you're doing it in a complicated way. I don't see the point.


Log in to reply
 

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