C++ | O(1) Simple Swapping Solution
\n# Complexity\n- Time complexity: O(1)\n Add your time complexity here, e.g. O(n) \n\n- Space complexity: O(1)\n Add your space complexity here, e.g. O(n) \n\n
\n# Complexity\n- Time complexity: O(1)\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity: O(1)\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```\nclass Solution {\npublic:\n    bool canBeEqual(string s1, string s2) {  \n        string cpy = s1;\n        swap(s1[0],s1[2]);\n        if(s1==s2)return 1;\n        swap(s1[1],s1[3]);\n        if(s1==s2)return 1; \n        swap(s1[1],s1[3]);\n        \n        s1 = cpy;   \n        if(s1==s2)return 1;\n        swap(s1[0],s1[2]);\n        if(s1==s2)return 1;\n        return false;\n    }\n};\n```
['C++']