Java | Sliding Window & HashMap | Simple & Easy Solution
Code\n\nclass Solution {\n    public int numberOfSubstrings(String s) {\n        int last[] = new int[]{-1,-1,-1}, ans = 0, n = s.length();\n        for(int i =
# Code\n```\nclass Solution {\n    public int numberOfSubstrings(String s) {\n        int last[] = new int[]{-1,-1,-1}, ans = 0, n = s.length();\n        for(int i = 0; i < n; i++) {\n            last[s.charAt(i) - \'a\'] = i;\n            ans += Math.min(Math.min(last[0], last[1]), last[2]) + 1;\n        }\n        return ans;\n    }\n}\n```\n- Do Upvote if this helps \u2B06\uFE0F \uD83D\uDC4D\uD83C\uDFFB
['Hash Table', 'Sliding Window', 'Java']