dsa1 min read
Longest Subarray of 1s After Deleting One Element [Medium] — Sliding Window
Find the longest subarray of 1s after deleting exactly one element using a sliding window that tracks the count of zeros.
Read →
1575 articles
Find the longest subarray of 1s after deleting exactly one element using a sliding window that tracks the count of zeros.
Find the maximum number of points on the same line using a slope-as-fraction HashMap for each anchor point.
Find the longest valid parentheses substring using a stack that tracks the last unmatched index as a base.
Find the shortest subarray that when sorted makes the whole array sorted, using a single linear scan tracking violated boundaries.
Count subarrays where max element is in [L,R] using a clever counting formula with two linear scans.