All Posts

Leetcode 2529: Maximum Count of Positive Integer and Negative Integer

You are given an array of integers sorted in non-decreasing order. Your task is to determine the maximum count between the number of positive integers and the number of negative integers in the array. Zero is not considered positive or negative.

Leetcode 2531: Make Number of Distinct Characters Equal

You are given two strings, word1 and word2. In each move, you swap one character from word1 with one from word2. Determine if it is possible to make the number of distinct characters in both strings equal with exactly one swap.

Leetcode 2586: Count the Number of Vowel Strings in Range

You are given a 0-indexed integer array nums. You can rearrange the elements of nums to any order (including the given order). Define the prefix sum array of nums as prefix[i] = sum(nums[0] to nums[i]) after rearranging. The score of nums is the number of positive integers in the prefix array. Return the maximum score you can achieve by rearranging the elements of nums.

Leetcode 2748: Number of Beautiful Pairs

You are given an array ’nums’ containing integers. A pair of indices ‘i, j’ is considered beautiful if the first digit of nums[i] and the last digit of nums[j] are coprime. Two numbers are coprime if their greatest common divisor (GCD) is 1, i.e., ‘gcd(x, y) == 1’. Your task is to find the total number of beautiful pairs in nums.

Leetcode 2833: Furthest Point From Origin

You are given a string moves consisting of characters ‘L’, ‘R’, and ‘’. The string represents movements on a number line starting from position 0. You can choose to move left or right when the character is ‘’, and the goal is to calculate the maximum distance from the origin you can reach after completing all the moves.

Leetcode 2856: Minimum Array Length After Pair Removals

You are given a non-decreasing sorted integer array. Perform operations to remove pairs of elements where nums[i] < nums[j] and return the minimum length of the array after the operations.