Intuition
- Using two pointer to border the sliding window.
- Using a map to save the count of each character appearance and a map to save the count of character in the window.
solution
|
|
problem
WA.
reason
When adding the count, it didn’t take consider of the duplicate chars, so maybe the count is greater or equal to the length of t, but maybe there’s some wrong case(such as window is [b,b] but t is [a,b]).
modification
Need to avoid the duplicate case.
|
|