Easiest Way to Solve this Question ! (With Explanation)
Intuition\n Describe your first thoughts on how to solve this problem.  If both Strings are same no need to check further. After that if the vector size is 4 th
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. --> If both Strings are same no need to check further. After that if the vector size is 4 then only it is possible to swap one character with another character of that string to get the second string.(Atmost one character swap can be done with another) \nLike, **(b)an(k) --> (k)an(b) :- all total 4 characters.**\n\n# Approach\n<!-- Describe your approach to solving the problem. --> Taking one vector. By iterating one loop, whenever there is mismatch of the character of both strings, insert it in the vector. If vector size is less than or greater than 4, return false. **Else vec[0]==vec[3] && vec[1]==vec[2], then return true, otherwise return false.**\n\n# Complexity\n- Time complexity: O(N)\n<!-- Add your time complexity here, e.g. $$O(n)$$ --> \n\n- Space complexity: O(N)\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n\n# Code\n```\nclass Solution {\npublic:\n    bool areAlmostEqual(string s1, string s2) {\n        if(s1==s2)\n            return true;\n        vector<int> vec;\n        for(int i=0;i<s1.size();i++)\n        {\n            if(s1[i]!=s2[i])\n            {\n                vec.push_back(s1[i]);\n                vec.push_back(s2[i]);\n            }\n        }\n        if(vec.size()>4 || vec.size()<4)\n            return false;\n        else \n        {\n            if(vec[0]==vec[3] && vec[1]==vec[2])\n                return true;\n        }\n        return false;\n    }\n};\n```\n\n---\n\n\n\n**Upvote and Make me Happy \uD83C\uDF89**\n\n![dc46816c3f6fa732acf9a45abafc50ac.jpg](https://assets.leetcode.com/users/images/ac2f0522-76ff-4a75-bc1c-de0231d09bf5_1687587342.7354107.jpeg)
['Array', 'String', 'C', 'C++']