class Solution {
public int[] minOperations(String boxes) {
char[] chars = boxes.toCharArray();
int n = chars.length;
int[] res = new int[n];
for (int i = 0; i < n; i++) {
for(int j = 0; j < n; j ++) {
if (i != j) {
res[i] += Math.abs(i - j) * (chars[j] - '0');
}
}
}
return res;
}
}
标签:操作数,int,res,chars,1769,球到
From: https://www.cnblogs.com/eiffelzero/p/16943265.html