同https://blog.csdn.net/ShellDawn/article/details/109499135
/*
* @lc app=leetcode id=448 lang=cpp
*
* [448] Find All Numbers Disappeared in an Array
*/
// @lc code=start
class Solution {
public:
vector<int> findDisappearedNumbers(vector<int>& nums) {
int N = nums.size();
int M = N + 1;
int t;
for(int i=0;i<N;i++){
t = nums[i] % M - 1;
nums[t] += M;
}
vector<int> ans;
for(int i=0;i<N;i++){
t = nums[i] / M;
if(t == 0) ans.push_back(i+1);
}
return ans;
}
};
// @lc code=end