Skip to content

Tag Archives: sliding-window

Given a binary array a[] or size N and an integer K, the task is to find the longest subarray consisting of only 1s or… Read More
Given an array A[] of length N and two integers X and K, The task is to count the number of indices i (0 ≤… Read More
Given a string S of size N consisting of the characters 0, 1 and 2, the task is to find the length of the smallest… Read More
Given a binary sequence of 1‘s and 0‘s. Our task is to remove all 1s from the sequence in minimum cost by below operations. Remove… Read More
Given a text txt[0..n-1] and a pattern pat[0..m-1], write a function search(char pat[], char txt[]) that prints all occurrences of pat[] and its permutations (or… Read More
Given a binary string str of length N, the task is to find the number of setbits in the bitwise OR of all the K… Read More
Given a binary circular array arr[] of size N, the task is to find the minimum swaps to group all 0s together in the array.… Read More
Given two arrays X[] and Y[] of size N, the task is to find the longest subarray in X[] containing only unique values such that… Read More
Given a string str of length N (divisible by 3) consisting of atmost three distinct characters, the task is to find the length of the… Read More
Given an array nums[] and a value k. The task is to find the maximum elements that can be made equal with at most k… Read More
Given a binary array arr[] of N integers, the task is to find the maximum count of distinct sized subarrays such that the sum of… Read More
Given an array arr[] containing N positive integers and an integer K. The task is to replace every array element with the average of previous… Read More
Given an array arr[] of N integers and an integer K, the task is to find the length of the longest subarray that forms an… Read More
Given an array arr[] containing integers. The task is to find the number of decreasing subarrays with a difference of 1.  Examples:  Input: arr[] =… Read More
Given binary string str, the task is to find the count of K length subarrays containing only 1s. Examples Input: str = “0101000”, K=1Output: 2Explanation:… Read More

Start Your Coding Journey Now!