Java. Loop. Check if One String Swap Can Make Strings Equal
\n# Complexity\nO(n)\n\n# Code\n\nclass Solution {\n    public boolean areAlmostEqual(String s1, String s2) {\n        if (s1.equals(s2)) return true;\n        
\n# Complexity\nO(n)\n\n# Code\n```\nclass Solution {\n    public boolean areAlmostEqual(String s1, String s2) {\n        if (s1.equals(s2)) return true;\n        int []alpha = new int[s1.length()];\n        int one = -100;\n        int two = -100;\n        for (int i = 0; i < s1.length(); i++)\n        {\n            if (s1.charAt(i) != s2.charAt(i))\n            {\n                if (one == -100 && two == -100) {\n                    one = s1.charAt(i) - \'a\';\n                    two = s2.charAt(i) - \'a\';\n                }\n                else\n                {\n                    one -= s2.charAt(i) - \'a\';\n                    two -= s1.charAt(i) - \'a\';\n                }\n            }\n        }\n        return one == 0 && two == 0;\n    }\n}\n```
['Java']