All Posts
Leetcode 1744: Can You Eat Your Favorite Candy on Your Favorite Day?
You are given an array candiesCount
where each element represents the number of candies of a particular type. You are also given a set of queries, each asking whether it’s possible to eat a candy of a certain type on a specific day without exceeding a daily candy limit. You must follow these game rules:
- You start eating candies on day 0.
- You cannot eat candies of type
i
until you have eaten all candies of typei-1
. - You must eat at least one candy per day.
Your task is to return an array of booleans where each element indicates whether it’s possible to eat a candy of the specified type on the given day, subject to the daily cap.
Leetcode 1749: Maximum Absolute Sum of Any Subarray
nums
, your task is to find the maximum absolute sum of any subarray. The absolute sum of a subarray is the absolute value of the sum of its elements.
Given an array of integers Leetcode 1750: Minimum Length of String After Deleting Similar Ends
You are given a string s
consisting of only the characters ‘a’, ‘b’, and ‘c’. Your task is to repeatedly perform the following operation any number of times:
- Pick a non-empty prefix from the string where all characters are equal.
- Pick a non-empty suffix from the string where all characters are equal.
- The prefix and suffix should not intersect, and the characters in both should be the same.
- Remove the prefix and suffix.
Your goal is to find the minimum length of the string after performing the operation any number of times.