C++ || Easy || 2 methods || brute -> optimize
Intuition\n\nSearch a (element of Array1 ) in Array 2 , if it is not present in Array-> it is part of our answer of Array1 part.\n\nRepeate same for Array2\n\nA
# Intuition\n***\nSearch a (element of Array1 ) in Array 2 , if it is not present in Array-> it is part of our answer of Array1 part.\n\nRepeate same for Array2\n\nAdd both part in another 2D Array \n\n# Approach 1\n***\nLet\'s Store all Element in set so that no repeating element is not there and also we can use the count method (To find the presense of a element in set).\n\nItrate Over one set and find presence in second set --->\n-> if element present in second set = skip\n-> if not -> store to our answer vector\n` HERE , CONUT FUCTION RETURN 0 IF ELEMENT IS NOT PRESENT OTHERWISE 1 `\n***\n```\nHOPE YOU LIKE IT !! PLEASE VOTE UP...\n```\n***\n\n# Complexity\n- Time complexity:\nO(N*log(N))\n- Space complexity:\nO(N)\n\n# Code 1 (N*log(N))\n***\n```\nclass Solution {\npublic:\n    vector<vector<int>> findDifference(vector<int>& nums1, vector<int>& nums2) {\n\t\tvector<vector<int>> ans =  {{},{}};\n        set<int> s1(nums1.begin(),nums1.end());\n        set<int> s2(nums2.begin(),nums2.end());\n        \n\n        for(auto x : s1){\n            if(s2.count(x)==0) ans[0].push_back(x);\n        }\n        for(auto x : s2){\n            if(s1.count(x)==0) ans[1].push_back(x);\n        }\n\t\t\n        return ans;\n    }\n};\n```\n***\n```\nHOPE YOU LIKE IT !! PLEASE VOTE UP...\n```\n***\n# Approach 2\n***\nThis is simple bruet force \n\nItrate Over one Array and find presence in second Array --->\n-> if element present in second Array = skip\n-> if not -> store to our answer vector\n\n# Complexity\n- Time complexity:\nO(N*N)\n- Space complexity:\nO(N)\n# Code 2 (N*N)\n***\n```\nclass Solution {\npublic:\n    vector<vector<int>> findDifference(vector<int>& nums1, vector<int>& nums2) {\n        set<int> st;\n        vector<vector<int>> ans;\n        for(int a : nums1){\n            int f=1;\n            for(int b : nums2){\n                if(a==b) f=0;\n            }\n            if(f) st.insert(a);\n        }\n        vector<int> tp;\n        for(int a : st){\n            tp.push_back(a);\n        }\n        ans.push_back(tp);\n        st.clear();\n        tp.clear();\n        for(int a : nums2){\n            int f=1;\n            for(int b : nums1){\n                if(a==b) f=0;\n            }\n            if(f) st.insert(a);\n        }\n        for(int a : st){\n            tp.push_back(a);\n        }\n        ans.push_back(tp);\n        return ans;\n    }\n};\n```\n\n***\n```\nHOPE YOU LIKE IT !! PLEASE VOTE UP...\n```\n***\n
['C++']