All Posts

Leetcode 1657: Determine if Two Strings Are Close

Two strings are considered transformable into each other if you can convert one into the other by performing a series of operations. These operations include swapping any two characters or transforming all occurrences of one character into another.

Leetcode 1658: Minimum Operations to Reduce X to Zero

You are given an array of integers nums and an integer x. In each operation, you can either remove the leftmost or rightmost element from the array and subtract its value from x. The task is to determine the minimum number of operations required to reduce x to exactly 0, or return -1 if it’s not possible.

Leetcode 1674: Minimum Moves to Make Array Complementary

You are given an integer array nums of even length n and an integer limit. In one move, you can replace any element of nums with another integer between 1 and limit (inclusive). The array nums is complementary if for all indices i, nums[i] + nums[n - 1 - i] equals the same number. Return the minimum number of moves required to make nums complementary.

Leetcode 1684: Count the Number of Consistent Strings

You are given a string allowed consisting of distinct characters, and an array of strings words. A string is consistent if all characters in the string appear in the string allowed. Return the number of consistent strings in the array words.

Leetcode 1695: Maximum Erasure Value

You are given an array of positive integers. Your task is to erase a subarray containing only unique elements and return the maximum sum of the subarray you can erase.

Leetcode 1726: Tuple with Same Product

You are given an array of distinct positive integers nums. Your task is to count how many tuples (a, b, c, d) exist such that the product of a * b equals the product of c * d, where a, b, c, d are distinct elements of nums and a != b != c != d.