Problem link This is another sliding window problem. At first glance, this doesn’t seem to be a straightforward sliding window. Let’s take a look at it closely. Let’s break down the problem first.1. We need to keep track of the total number of satisfied customers. This is easy.2. We also need to find out unsatisfied READ MORE
Month: February 2025
LeetCode 1343 Number of Subarrays of Size K and Average Greater than Equal to Threshold
link to the problem This is sliding window problem. Let’s see how sliding window elegantly solves the problem. Bruteforce: generate all subarrays of size k. Then compute the average of all the subarrays that are greater than equal to the threshold.Time complexity is O(n^2) for generating subarrays and computing the average. Is there a better READ MORE