All Posts

Leetcode 2287: Rearrange Characters to Make Target String

You are given two strings, s and target. Your task is to determine the maximum number of times you can rearrange the characters of s to form the string target. A character from s can only be used once in the target string, and the letters must be rearranged to form a new target string each time.

Leetcode 2341: Maximum Number of Pairs in Array

You are given an integer array nums. In one operation, you can choose two integers in the array that are the same and remove both. The operation is repeated as many times as possible. Return an array where the first element is the number of pairs formed, and the second element is the number of leftover integers.

Leetcode 2347: Best Poker Hand

You are given an integer array ranks and a character array suits. These represent a set of 5 playing cards, where each card has a rank (from 1 to 13) and a suit (one of ‘a’, ‘b’, ‘c’, or ’d’). Determine the best possible poker hand you can make from the cards.

Leetcode 2351: First Letter to Appear Twice

Given a string s of lowercase English letters, return the first letter that appears twice.

Leetcode 2364: Count Number of Bad Pairs

You are given a 0-indexed integer array, nums. A pair of indices (i, j) is considered a ‘bad pair’ if i < j and j - i is not equal to nums[j] - nums[i]. Your task is to determine the total number of bad pairs in the array.

Leetcode 2384: Largest Palindromic Number

You are given a string num consisting only of digits. Your task is to form the largest possible palindromic number by rearranging the digits of num. The resulting number should not have leading zeros and must use at least one digit from the string.