【LeetCode】 五月打卡-day08
442. 数组中重复的数据
class Solution {
public List
List
int n = nums.length;
for (int i = 0; i < n; i++) {
int t = nums[i];
if (t < 0 || t - 1 == i) continue;
if (nums[t - 1] == t) {
ans.add(t);
nums[i] *= -1;
} else {
共有 0 条评论