All Posts

Leetcode 2404: Most Frequent Even Element

You are given an integer array nums. Your task is to return the most frequent even element in the array. If there is a tie (i.e., multiple even elements appear the most number of times), return the smallest one. If there is no even element, return -1.

Leetcode 2423: Remove Letter To Equalize Frequency

You are given a string consisting of lowercase English letters. You must remove one letter from the string so that the frequency of all remaining letters is equal. Return true if it is possible to achieve this by removing exactly one letter, otherwise return false.

Leetcode 2442: Count Number of Distinct Integers After Reverse Operations

You are given an array nums consisting of positive integers. For each number in the array, you need to reverse its digits and append the reversed number to the end of the array. After performing this operation for all numbers, return the number of distinct integers in the resulting array.

Leetcode 2453: Destroy Sequential Targets

You are given a 0-indexed array ’nums’, where each element represents a target on a number line, and an integer ‘space’. A machine is available that can destroy all targets that can be represented by the formula nums[i] + c * space, where c is a non-negative integer. You need to choose an element from ’nums’ to seed the machine such that it destroys the maximum number of targets. Return the minimum value from ’nums’ that can seed the machine to destroy the most targets.

Leetcode 2506: Count Pairs Of Similar Strings

You are given a list of words, where each word consists of lowercase English letters. Two words are considered similar if they contain the exact same set of unique characters, regardless of the order. Your task is to count how many pairs of words (i, j) satisfy the condition where both words have the same set of unique characters. Return the count of such pairs (i, j) where 0 ≤ i < j ≤ len(words) - 1.

Leetcode 2526: Find Consecutive Integers from a Data Stream

You need to implement a DataStream class that processes a stream of integers and checks whether the last k integers in the stream are equal to a specified value.