Simple Two pointer approach | O(N) | O(1)
Complexity\n- Time complexity: o(N)\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# Co
# Complexity\n- Time complexity: o(N)\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 {\n    public boolean canBeEqual(String s1, String s2) {\n        if (s1.length() != s2.length()) return false;\n        \n        for(int i = 0; i < s1.length(); i++){\n            if(s1.charAt(i) != s2.charAt(i) && s1.charAt(i) != s2.charAt((i + 2) % s1.length())) return false;\n        }\n        return true;\n    }\n}\n```
['Java']