All Posts
Leetcode 2217: Find Palindrome With Fixed Length
You are given an array of queries and a positive integer intLength. For each query, you need to find the query-th smallest palindrome of length intLength. A palindrome is a number that reads the same backward and forward, and it cannot have leading zeros. If no such palindrome exists for a query, return -1.
Leetcode 2221: Find Triangular Sum of an Array
nums
, where each element is a digit between 0 and 9. The triangular sum of nums
is computed by repeatedly reducing the array by replacing each element with the sum of two consecutive elements, modulo 10. This process continues until only one element remains, which is the triangular sum. Your task is to return the triangular sum of the array.
You are given a 0-indexed integer array Leetcode 2222: Number of Ways to Select Buildings
s
that represents the types of buildings along a street. Each building is either an office (‘0’) or a restaurant (‘1’). You are tasked with selecting 3 buildings for inspection, with the constraint that no two consecutive buildings in the selection can be of the same type. Return the number of valid ways to select 3 buildings where no two consecutive buildings are of the same type.
You are given a binary string 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.