Time limited? It is super easy to understand!!


  • 0
    Y

    class Solution {
    public:
    vector<int> findDuplicates(vector<int>& nums) {
    vector<int> repeat;
    vector<int> output;
    bool check;
    for(int i=0;i<nums.size();i++){
    repeat.push_back(nums[i]);
    for(int j=0;j<repeat.size();j++){
    if(repeat[j]==nums[i] && i!=j){
    output.push_back(repeat[j]);
    break;}
    }}
    return output;
    }
    };


Log in to reply
 

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.