[Java] ✅ 1ms ✅ 100% ✅ FAST ✅ BEST ✅ SIMPLE ✅ CLEAN CODE
Approach\n1. For the two strings to match, they need to have the same letters of pos [0,2] and [1,3].\n2. For i = 0 and i = 1, check if they match on pairs (s1[
# Approach\n1. For the two strings to match, they need to have the same letters of pos [0,2] and [1,3].\n2. For i = 0 and i = 1, check if they match on pairs (s1[i]== s2[i] & s1[i+2] == s2[i+2]) OR (s1[i] == s2[i+2] && s1[i+2] == s2[i]);\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```java []\nclass Solution {\n    public boolean canBeEqual(String s1, String s2) {\n        return areMatching(s1,s2, 0) && areMatching(s1, s2, 1);\n    }\n\n    public boolean areMatching(String s1, String s2, int i) {\n        return ((s1.charAt(i) == s2.charAt(i) && s1.charAt(i+2) == s2.charAt(i+2))\n            || (s1.charAt(i) == s2.charAt(i+2) && s1.charAt(i+2) == s2.charAt(i)));\n    }\n}\n```
['Java']