Given a string, find the length of the longest substring T that contains at most 2 distinct characters.
For example, Given s =
“eceba”
,
T is "ece" which its length is 3.
Solution:
To solve substring problem, could use following template:
A better solution is:
Round 2 solution:
Rnd3 sol:
No comments:
Post a Comment