All content related to sliding-window

Max Consecutive Ones

An input binary array X[] is given where all the elements are either 0 or 1. Write a program to find the maximum consecutive ones in this binary array.

Max Continuous Series of 1s

You are given an array of 1s and 0s and you are given an integer k which signifies the number of flips allowed. Write a program to find the position of zeros which when flipped will produce maximum continuous series of 1s.This is one of the good problems to understand the idea of the sliding window technique. Using this approach, We can solve several interview problems efficiently in O(n) and O(1) space.

Count distinct elements in every window

Given array X[] of n integers, write a program to return the count of distinct numbers in all windows of size k.

Longest Substring Without Repeating Characters

Write a program to find the length of the longest substring without repeating characters. Substring is the continuous sub-part of the string. The aim is to determine the maximum such subpart which has all the unique characters.

Our weekly newsletter

Subscribe to get free weekly content on data structure and algorithms, machine learning, system design, oops and math. enjoy learning!