C++ | 5 LINES | SIMPLE BRUTE FORCE🔥
Intuition\n\nThe problem stated that the strings length are of only four in size.\nThe difference in indices is j - i  = 2;\nTherefore we can conclude that ther
# Intuition\n```\nThe problem stated that the strings length are of only four in size.\nThe difference in indices is j - i  = 2;\nTherefore we can conclude that there are at most two operations \nwhich can be performed on index 0 and index 1 by swapping them\nwith index 2 and index 3.\n```\n\n# Complexity\n- Time complexity:\nO(1)\n\n- Space complexity:\nO(1)\n\n# Code\n```\nclass Solution {\npublic:\n    bool canBeEqual(string s1, string s2) {\n        if(s1 == s2) return true;\n        \n        if(s1[0] != s2[0]) swap(s1[0],s1[2]);\n        if(s1 == s2) return true;\n        \n        if(s1[1] != s2[1]) swap(s1[1],s1[3]);\n        if(s1 == s2) return true;\n        \n        return false;\n    }\n};\n```
['String', 'C++']