Blog Cover Image
Find Max Consecutive 1's in an Array

A binary array X[] is given where elements are either 0 or 1. Write a program to find the maximum consecutive ones. The subarray with max continuous 1's can be present anywhere, starting from some index i and ending at some index j. This is an excellent problem to learn problem-solving using the sliding window and a single loop.

Blog Cover Image
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.

Blog Cover Image
Count distinct elements in every k size window

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

Blog Cover Image
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 design and mathematics.