All Posts

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 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 2150: Find All Lonely Numbers in the Array

You are given an integer array ’nums’. A number ‘x’ is lonely if it appears exactly once and neither ‘x - 1’ nor ‘x + 1’ exist in the array. Return all lonely numbers in the array.

Leetcode 2154: Keep Multiplying Found Values by Two

You are given an array of integers ’nums’ and an integer ‘original’. Start with the number ‘original’ and search for it in the array. If found, multiply it by two. Repeat this process until ‘original’ is no longer found in ’nums’. Return the final value of ‘original’.

Leetcode 2166: Design Bitset

You are tasked with implementing a Bitset class that supports operations such as setting bits, clearing bits, flipping all bits, and querying the state of the bits (whether all bits are set to 1, at least one bit is set to 1, etc.).

Leetcode 2170: Minimum Operations to Make the Array Alternating

You are given a 0-indexed array nums consisting of n positive integers. The array nums is called alternating if nums[i - 2] == nums[i] and nums[i - 1] != nums[i] for all valid i. In one operation, you can choose an index i and change nums[i] into any positive integer. Your task is to return the minimum number of operations required to make the array alternating.