← ALL NOTES
Hash Table

1358. Number of Substrings Containing All Three Characters

A string of only 'a', 'b', 'c'; count substrings containing at least one of each. The slick O(1)-space trick: for each right endpoint, the count of valid substrings ending there is determined by the…

Loading…