What is the difference between Max_value and Min_value?


  • 0
    C
    public int jump(int[] nums) {
        if (nums == null || nums.length == 0)
        return 0;
        int[]minStep = new int[nums.length];
        minStep[0] = 0;
        for (int i = 1; i < nums.length; i++) {
            minStep[i] = Integer.MAX_VALUE;
            for (int j = 0; j < i; j++) {
                if ((minStep[j] != Integer.MAX_VALUE) && nums[j] + j >= i) {
                    minStep[i] = minStep[j] + 1; //? minStep[j] + 1 : minStep[i];
                    break;
                }
            }
        }
        return minStep[nums.length - 1];
    }
    

    I got a TLE problem for this code, but after I change MAX_VALUE to MIN_VALUE, it gets accepted. What's the difference ? Thanks!!!


Log in to reply
 

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