Skip to content

Latest commit

 

History

History
52 lines (35 loc) · 1.13 KB

leetcode_350.md

File metadata and controls

52 lines (35 loc) · 1.13 KB

a

https://leetcode.cn/problems/total-distance-traveled/description/

class Solution {
    public int distanceTraveled(int mainTank, int additionalTank) {
        return (Math.min(additionalTank, (mainTank - 1) / 4) + mainTank) * 10;
    }
}

b

https://leetcode.cn/problems/find-the-value-of-the-partition/

class Solution {
    public int findValueOfPartition(int[] nums) {
        Arrays.sort(nums);
        int res = Integer.MAX_VALUE;
        for (int i = 1; i < nums.length; i ++) {
            res = Math.min(res, nums[i] - nums[i - 1]);
        }
        return res;
    }
}

c

https://leetcode.cn/problems/special-permutations/

d

https://leetcode.cn/problems/painting-the-walls/