FlareStart
HomeNewsHow ToSources
FlareStart

Where developers start their day. All the tech news & tutorials that matter, in one place.

Quick Links

  • Home
  • News
  • Tutorials
  • Sources
  • Privacy Policy

Connect

© 2026 FlareStart. All rights reserved.

Back to articles
Mastering Fixed Sliding Window in C++ (LeetCode 1876)
NewsMachine Learning

Mastering Fixed Sliding Window in C++ (LeetCode 1876)

via Dev.toNithya Dharshini official1mo ago

Today I solved a beautiful Sliding Window problem that perfectly demonstrates how fixed-size windows work. Problem: Count substrings of size 3 with all distinct characters. Problem Understanding We are given a string s. We need to count how many substrings of length 3 contain all distinct characters. Example Input: s = "xyzzaz" Valid substrings of length 3: "xyz" "yzz" (z repeated) "zza" "zaz" Output: 1 Why Sliding Window? Since the substring size is fixed (3), this is a Fixed Sliding Window problem. Instead of generating all substrings (which would be inefficient), we: Maintain a window of size 3. Use a frequency map to track character counts. Slide the window one step at a time. Check if all characters are distinct. Approach Step 1 -> Initialize first window (size 3) Add first 3 characters into a hashmap. Step 2 -> Check validity If all frequencies are 1 → count it. Step 3 -> Slide the window For every next position Remove left character Add new right character Check validity again R

Continue reading on Dev.to

Opens in a new tab

Read Full Article
25 views

Related Articles

The Subprime Technical Debt Crisis
News

The Subprime Technical Debt Crisis

Lobsters • 20h ago

“It Worked on My Machine” — Until It Reached Production
News

“It Worked on My Machine” — Until It Reached Production

Medium Programming • 21h ago

The best way to protect your phone from a warrantless search in 2026
News

The best way to protect your phone from a warrantless search in 2026

ZDNet • 21h ago

Roku launches a standalone app for Howdy, its $2.99 streaming service
News

Roku launches a standalone app for Howdy, its $2.99 streaming service

TechCrunch • 21h ago

Meta launches two new Ray-Ban glasses designed for prescription wearers
News

Meta launches two new Ray-Ban glasses designed for prescription wearers

TechCrunch • 22h ago

Discover More Articles