All Posts

Leetcode 2125: Number of Laser Beams in a Bank

You are given a 2D binary grid, where ‘1’ represents a security device and ‘0’ represents an empty cell. A laser beam can be formed between two devices if they are located on two different rows and no security device is in any row between them. The task is to find the total number of laser beams that can be formed.

Leetcode 2126: Destroying Asteroids

You are given a planet with an initial mass. There are asteroids approaching the planet, each with its own mass. The planet can destroy an asteroid if its current mass is greater than or equal to the asteroid’s mass. After destroying an asteroid, the planet’s mass increases by the asteroid’s mass. You need to determine if the planet can destroy all the asteroids by strategically choosing the order of the collisions.

Leetcode 2131: Longest Palindrome by Concatenating Two Letter Words

You are given an array of strings, where each string consists of two lowercase English letters. The task is to create the longest possible palindrome by selecting some of these strings and concatenating them in any order. Each string can be used at most once. A palindrome is a string that reads the same forward and backward. Return the length of the longest palindrome that can be created, or 0 if it’s not possible to create any palindrome.

Leetcode 2133: Check if Every Row and Column Contains All Numbers

You are given an n x n matrix where each element is an integer. The matrix is considered valid if every row and every column contains all the integers from 1 to n (inclusive). Your task is to check whether the given matrix satisfies this condition. Return true if the matrix is valid, and false otherwise.

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.