check all the possible cases | | T.C/ O(1) & S.C /O(1) | | C++ 🔥
Complexity

Time complexity:
O(1)


Space complexity:
O(1)

Code
# Complexity
- Time complexity:
$$O(1)$$

- Space complexity:
$$O(1)$$

# Code
```cpp []
class Solution {
public:
    bool canBeEqual(string s1, string s2) {
        // All the four Possible Case are :-

        // Case-1 [S1 be Same]
        if (s1 == s2) {
            return true;
        }

        // Case-2 cdab
        swap(s1[0], s1[2]);
        swap(s1[1], s1[3]);
        if (s1 == s2) {
            return true;
        }

        // Case-3 cbad
        swap(s1[1], s1[3]);
        if (s1 == s2) {
            return true;
        }

        // Case-4 adcb
        swap(s1[0], s1[2]);
        swap(s1[1], s1[3]);
        if (s1 == s2) {
            return true;
        }

        return false;
    }
};
```
['String', 'C++']