Mark As Completed Discussion

Using Sliding Window

So the brute force approach isn't the best. Luckily, we can utilize the sliding window technique. We will break it down, but first let's observe the entire solution with comments. s is the string, and req_chars is the substring containing all the required characters.

JAVASCRIPT
OUTPUT
:001 > Cmd/Ctrl-Enter to run, Cmd/Ctrl-/ to comment