C# - Sliding window - easy & efficient code
Please upvote and comment if you like the solution!\n```\n public int EqualSubstring(string s, string t, int maxCost) {\n\tint n = s.Length, left = 0, window = 
Please upvote and comment if you like the solution!\n```\n public int EqualSubstring(string s, string t, int maxCost) {\n\tint n = s.Length, left = 0, window = 0, ans = int.MinValue;\n\tint[] cost = new int[n];\n\tfor (int right = 0; right < n; right++)\n\t{\n\t\tcost[right] = Math.Abs(s[right] - t[right]);\n\t\twindow += cost[right];\n\n\t\twhile (window > maxCost)\n\t\t\twindow -= cost[left++];\n\n\t\tans = Math.Max(ans, right - left + 1);\n\t}\n\treturn ans;\n    }
[]