Sefism early access is open for X and Instagram followers and university students.Get early access
Guide · Interview PrepFree

A 10-Line Template for Substring Problems

A classic LeetCode solution post that turns Minimum Window Substring into a reusable sliding window template using a character count map, a counter and two pointers, then shows how the same shape solves other substring problems such as longest substring without repeating characters. It is short and dense, so read it after you understand the basic idea of a sliding window. Code is in C++.

Format

Guide

Topic

Interview Prep

Provider

zjh08177 (LeetCode)

Level

Intermediate

Access

Free

A classic LeetCode solution post that turns Minimum Window Substring into a reusable sliding window template using a character count map, a counter and two pointers, then shows how the same shape solves other substring problems such as longest substring without repeating characters. It is short and dense, so read it after you understand the basic idea of a sliding window. Code is in C++.

algorithmscpp

Ready to start?

Opens on zjh08177 (LeetCode) in a new tab.

Open resource
Link broken or out of date?

Report a problem

With "A 10-Line Template for Substring Problems". Only Tauseef reads this.

Work with me

Stuck on something specific?

Writing only gets you so far. If you want an answer to your situation rather than the general case, book a session and we will work through it together. Sessions are free for approved Sefism members, and a few slots open each week.

Follow along

New writing, resources and project ideas land here first.