All Posts

Leetcode 1348: Tweet Counts Per Frequency

A social media company wants to analyze tweet activity by counting the number of tweets in given time periods, broken down by minute, hour, or day frequency. Design an API to record tweets and calculate the number of tweets within specific time intervals.

Leetcode 1351: Count Negative Numbers in a Sorted Matrix

You are given an m x n matrix grid, sorted in non-increasing order both row-wise and column-wise. Your task is to determine how many negative numbers are present in the grid.

Leetcode 1477: Find Two Non-overlapping Sub-arrays Each With Target Sum

You are given an array of integers arr and an integer target. You need to find two non-overlapping sub-arrays of arr each with a sum equal target. The goal is to minimize the sum of their lengths, and if no such sub-arrays exist, return -1.

Leetcode 1482: Minimum Number of Days to Make m Bouquets

You are given an integer array bloomDay, an integer m, and an integer k. Your goal is to form m bouquets using exactly k adjacent flowers. Each flower blooms on a particular day. Determine the minimum number of days required to form m bouquets, or return -1 if it is impossible.

Leetcode 1488: Avoid Flood in The City

Your country has an infinite number of lakes. Initially, all the lakes are dry, but on the nth day, the nth lake fills up with water. If it rains over a lake that is already full, there will be a flood. You need to avoid flooding by drying out lakes on some days when there is no rain.

Leetcode 1498: Number of Subsequences That Satisfy the Given Sum Condition

You are given an array of integers nums and an integer target. Your task is to count how many non-empty subsequences of nums exist such that the sum of the minimum and maximum element in each subsequence is less than or equal to target. Return the result modulo 10^9 + 7.