[C++] Simple O(N) logic, 0ms solution. [Detailed Explanation]
\n/*\n    https://leetcode.com/problems/check-if-one-string-swap-can-make-strings-equal/\n    \n    Find the number of positions which are different.\n    Now t
```\n/*\n    https://leetcode.com/problems/check-if-one-string-swap-can-make-strings-equal/\n    \n    Find the number of positions which are different.\n    Now the strings can be made equal only if there are 0 \n    different positions or 2 different positions and there are\n    chars on those positions which when swaped will make the\n    strings equal.\n    TC: O(N)\n    SC: O(1), At most 2 values are put in the diff_pos vector\n*/\n\nclass Solution {\npublic:\n    bool areAlmostEqual(string s1, string s2) {\n        // find the number of diff positions\n        vector<int> diff_pos;\n        for(int i = 0; i < s1.size(); i++) {\n            if(s1[i] != s2[i])\n                diff_pos.emplace_back(i);\n            // If there are more than 2 char positions that differ, \n            // the single swap op cannot anyway make the two strings equal\n            if(diff_pos.size() > 2)\n                return false;\n        }\n        // when the chars are exactly the same\n        if(diff_pos.empty())\n            return true;\n        // only one pair of diff positions, check if swapping makes them equal\n        if(diff_pos.size() == 2) \n            swap(s1[diff_pos[0]], s1[diff_pos[1]]);\n        \n        return s1 == s2;\n    }\n};\n```
['C', 'C++']