Skip to content

Bhanu's Blog

it's not about being the best it's about being better than yesterday

Bhanu's Blog

it's not about being the best it's about being better than yesterday

Day: April 29, 2025

Leetcode

Counting Subarrays Where the Max Appears At Least K Times (LeetCode 2962)

  • bhanunadar
  • Posted on April 29, 2025

Problem Summary You’re given an integer array nums and a number k. Your task is to count the number of subarrays where the maximum element of the entire array appears at least k times. Sliding Window to the Rescue This is a classic case where brute force (O(n²)) would time out. The key to optimizing…

Read More

Recent Posts

  • TIL: Docker Namespaces
  • My Experience with LG Ultragear 32GS60QC (32 inch)
  • TIL: Value Classes
  • Counting Subarrays Where the Max Appears At Least K Times (LeetCode 2962)
  • Solo motorcycle trip to Ratnagiri from Mumbai

Copyright © All rights reserved. Proudly powered by WordPress | Theme: Blog Nano by ThemeMiles.