All Posts

Leetcode 2579: Count Total Number of Colored Cells

You are given a 2D array ranges, where each entry ranges[i] = [starti, endi] denotes a range of integers between starti and endi (inclusive). You need to split the ranges into two groups, ensuring that overlapping ranges belong to the same group. Return the total number of ways to split the ranges into two groups modulo (10^9 + 7).

Leetcode 2580: Count Ways to Group Overlapping Ranges

There are n people standing in a line labeled from 1 to n. The first person starts with a pillow. Every second, the person holding the pillow passes it to the next person in line. Once the pillow reaches the last person in the line, it starts moving back in the opposite direction, passing towards the first person. Given n and time, return the index of the person holding the pillow after time seconds.

Leetcode 2583: Kth Largest Sum in a Binary Tree

You are given a 0-indexed array of strings words and two integers left and right. A string is considered a vowel string if it starts and ends with a vowel character (vowels are ‘a’, ’e’, ‘i’, ‘o’, ‘u’). Your task is to return the number of vowel strings in the array words where the indices fall within the range [left, right].

Leetcode 2587: Rearrange Array to Maximize Prefix Score

You are given a 0-indexed integer array nums. In one operation, you can choose two indices and subtract a power of two from both elements at those indices. A subarray is considered beautiful if you can make all of its elements equal to zero by applying the operation any number of times. Your task is to return the number of beautiful subarrays in nums.

Leetcode 2588: Count the Number of Beautiful Subarrays

You are given a 0-indexed integer array nums. In one operation, you can choose two indices and subtract a power of two from both elements at those indices. A subarray is considered beautiful if you can make all of its elements equal to zero by applying the operation any number of times. Your task is to return the number of beautiful subarrays in nums.

Leetcode 2592: Maximize Greatness of an Array

You are given an integer array nums. You can permute (rearrange) the elements of nums into a new array perm. Define the greatness of nums as the number of indices 0 <= i < nums.length where perm[i] > nums[i]. Your task is to return the maximum possible greatness you can achieve after permuting nums.