0ms || Beats 100 %
Intuition\n Describe your first thoughts on how to solve this problem. \n\n\n# Approach\n Describe your approach to solving the problem. \n\n# Complexity\n- Tim
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\n![{E212B706-133A-40E7-9769-EE836446C1F0}.png](https://assets.leetcode.com/users/images/fe35a5fc-5bc6-4139-a7c0-aae002ef0c39_1728546080.7742336.png)\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\n\n# Complexity\n- Time complexity:\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity:\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```cpp []\nclass Solution {\npublic:\n    bool canBeEqual(string s1, string s2) {\n        for(int i = 0 ; i<s1.length() ; i++){\n            int j = i+2;\n            if(j<s2.length()&& j-i == 2){\n                if(s1[i] == s2[j]) {\n                    swap(s2[i] , s2[j]);\n                }\n            }\n        }\n\n        return s1 == s2;\n    }\n};\n\nauto init = [](){\n    ios::sync_with_stdio(0);\n    cin.tie(0);\n    cout.tie(0);\n    return \'x\';\n}();\n```
['C++']