-
Continue reading →: Count Number of anagrams
Given a word pat and a text txt. Return the count of the occurrences of anagrams of the word in the text. Example 1: Input: txt = forxxorfxdofr pat = for Output: 3 Explanation: for, orf and ofr appears in the txt, hence answer is 3. https://www.geeksforgeeks.org/problems/count-occurences-of-anagrams5839 slight variation of the problem: https://leetcode.com/problems/find-all-anagrams-in-a-string/…
-
Continue reading →: First negative integer in every window of size k
Problem Statement: Given an array and a positive integer k, find the first negative integer for each window(contiguous subarray) of size k. If a window does not contain a negative integer, then print 0 for that window. Examples: Input : arr[] = {-8, 2, 3, -6, 10}, k = 2Output…
-
Continue reading →: Maximum sum of subarray of SIZe k
Refer to g4g: https://www.geeksforgeeks.org/find-maximum-minimum-sum-subarray-size-k/ Simple Solution to this problem can be a brute force where we can check all the K size subarrays. For example If input is 4, 2, 1, 7, 8, 1, 2, 8, 1, 0 and K 3 We can take 4, 2,1 2, 1, 7 1,…
-
Continue reading →: SLIDING WINDOW
I am listing all problems which I encounter related to sliding window here. Feel free add more in the comments. Sr Problem Title Blog LeetCode GeeksforGeeks 1 Longest Substring Without Repeating Characters https://leetcode.com/problems/longest-substring-without-repeating-characters/ https://www.geeksforgeeks.org/problems/length-of-the-longest-substring3036/1 2 Maximum Sum Subarray https://leetcode.com/problems/maximum-subarray/ https://www.geeksforgeeks.org/sum-of-all-subarrays/ 3 Find the Largest Window Size with Maximum Elements N/A…