All Posts

Leetcode 2134: Minimum Swaps to Group All 1's Together II

You are given a binary circular array, where each element is either 0 or 1. The goal is to group all the 1’s together in the array using the minimum number of swaps. A swap consists of exchanging the values at two distinct positions in the array. The array is circular, meaning the first and last elements are adjacent. Your task is to find the minimum number of swaps required to group all the 1’s together.

Leetcode 2135: Count Words Obtained After Adding a Letter

Given two arrays of strings, startWords and targetWords, determine how many strings in targetWords can be formed by appending a letter to any string in startWords and rearranging the letters.

Leetcode 2139: Minimum Moves to Reach Target Score

You start with the integer 1, and you need to reach the target integer using the minimum number of moves. In one move, you can either increment the current integer by 1 or double it. The doubling operation can be used at most maxDoubles times.

Leetcode 2140: Solving Questions With Brainpower

You are given a 2D list of questions. Each question is represented by a pair of values: the points earned by solving it and the number of subsequent questions you can’t solve after completing it. You need to maximize the total points earned by choosing which questions to solve.

Leetcode 2145: Count the Hidden Sequences

You are given an array representing the differences between each pair of consecutive integers of a hidden sequence. You are also given two integers, lower and upper, which define an inclusive range that the elements of the hidden sequence can take. Your task is to determine the number of possible hidden sequences that fit the given differences and lie within the specified range.

Leetcode 2146: K Highest Ranked Items Within a Price Range

You are given a 2D grid representing a shop map with walls, empty spaces, and items with prices. Your task is to find the top k highest-ranked items within a given price range. The ranking is based on distance, price, row, and column number.