All Posts
Leetcode 2559: Count Vowel Strings in Ranges
Given an array of strings words and a list of queries, each query asks to count the number of strings in the specified range that start and end with a vowel. The vowels are ‘a’, ’e’, ‘i’, ‘o’, and ‘u’.
Leetcode 2560: House Robber IV
A robber is tasked with stealing money from houses lined along a street. Each house has a certain amount of money, but the robber refuses to rob adjacent houses. The robber must steal from at least ‘k’ houses. Your goal is to determine the minimum amount of money the robber will steal from any house, out of all the possible ways of selecting at least ‘k’ houses, given the constraints.
Leetcode 2562: Find the Array Concatenation Value
You are given an array of integers, nums, and you need to calculate the total concatenation value. To calculate this, you repeatedly perform the following operations until the array is empty:
- If the array has more than one element, take the first and last elements, concatenate them, and add the result to the total concatenation value. Then remove the first and last elements from the array.
- If the array has only one element, add it to the total concatenation value and remove the element.
The goal is to return the total concatenation value after performing all the operations.
Leetcode 2563: Count the Number of Fair Pairs
Given an integer array nums of size n and two integers lower and upper, find the number of fair pairs. A pair (i, j) is considered fair if it satisfies the following conditions:
0 <= i < j < nlower <= nums[i] + nums[j] <= upper
Return the number of such pairs.
Leetcode 2564: Substring XOR Queries
You are given a binary string s and a 2D array of queries. Each query is represented as [firsti, secondi], where firsti and secondi are integers. For each query, you need to find the shortest substring of s whose decimal value XORed with firsti equals secondi.
In other words, find a substring whose decimal value, when XORed with firsti, results in secondi. If such a substring exists, return its starting and ending indices (0-indexed). If no such substring exists, return [-1, -1].
If there are multiple valid substrings, return the one with the smallest starting index.