消息推送Leetcode每日一题 —— 2333. 最小差值平方和09:50 · 2026年10月10日 · 周六Leetcode每日一题 —— 2333. 最小差值平方和🌐 链接: https://linux.do/t/topic/3002582🏷️ 分组: LinuxDo论坛🕒 时间: 2026-10-10 09:48:33 LINUX DO Leetcode每日一题 —— 2333. 最小差值平方和 思路 题目等价于给一个数组diff[n],元素可上下浮动k,求最小平方和。其中diff[i]=Math.abs(nums1[i]-nums2[i]); k=k1+k2。 全是正数的情况下 n^2-(n-1)^2 > (n-1)^2-(n-2)^2,所以我们显然应该用贪心从最大数开始浮动。 一开始用 PriorityQueue 能过但太慢了,换成 Array 排序快多了。 代码 class Solution { public long minSumSquareDiff(int[] nums1… 09:50 · 2026年10月10日 · 周六