All Posts

Leetcode 2225: Find Players With Zero or One Losses

You are given an array matches where each element matches[i] = [winneri, loseri] indicates that player winneri defeated player loseri in a match. Your task is to return a list answer of size 2 where:

  • answer[0] contains the list of players who have never lost a match.
  • answer[1] contains the list of players who have lost exactly one match.

The players in both lists should be sorted in increasing order.

Leetcode 2249: Count Lattice Points Inside a Circle

You are given a 2D integer array circles, where each element circles[i] = [xi, yi, ri] represents a circle with center at (xi, yi) and radius ri. The task is to find the number of lattice points that lie inside at least one of the given circles. A lattice point is defined as a point with integer coordinates, and points lying on the circumference of a circle are also considered inside.

Leetcode 2260: Minimum Consecutive Cards to Pick Up

You are given an array cards where each element represents a card’s value. A matching pair of cards occurs when two cards have the same value. Your task is to find the minimum number of consecutive cards you need to pick to guarantee that you have a pair of matching cards. If it’s impossible to find a matching pair, return -1.

Leetcode 2261: K Divisible Elements Subarrays

You are given an integer array nums and two integers k and p. Your task is to count the number of distinct subarrays where there are at most k elements divisible by p. A subarray is defined as a contiguous part of the array, and two subarrays are considered distinct if they differ in either length or at least one element.

Leetcode 2266: Count Number of Texts

Alice is texting Bob using her phone’s keypad. Each digit from ‘2’ to ‘9’ maps to multiple letters, and Alice has to press a key several times to type each letter. However, due to a transmission error, Bob receives a string of digits corresponding to the number of key presses rather than the message itself. Your task is to determine how many possible messages Alice could have sent, given the sequence of digits Bob received. The answer should be returned modulo 1e9 + 7.

Leetcode 2273: Find Resultant Array After Removing Anagrams

You are given a 0-indexed string array words, where each element of words[i] consists of lowercase English letters. In one operation, you can delete any word words[i] if it is an anagram of the previous word words[i-1]. Repeat this operation until no more deletions are possible. Your task is to return the list of words after performing all possible operations.