All Posts

Leetcode 2311: Longest Binary Subsequence Less Than or Equal to K

You are given a binary string s and a positive integer k. Your task is to find the length of the longest subsequence of s that represents a binary number less than or equal to k when converted to decimal.

Leetcode 2316: Count Unreachable Pairs of Nodes in an Undirected Graph

You are given an undirected graph with n nodes and a list of edges connecting the nodes. The goal is to find the number of pairs of distinct nodes that are unreachable from each other.

Leetcode 2317: Maximum XOR After Operations

You are given an integer array nums. In each operation, select a non-negative integer x and an index i, then update nums[i] to be equal to nums[i] AND (nums[i] XOR x). The task is to find the maximum possible bitwise XOR of all elements after applying the operation any number of times.

Leetcode 2320: Count Number of Ways to Place Houses

Given a street with two rows of plots, each containing n plots, find the number of ways houses can be placed such that no two houses are adjacent on the same side of the street. Return the result modulo 10^9 + 7.

Leetcode 2326: Spiral Matrix IV

You are given two integers, m and n, which represent the dimensions of a matrix. You are also given the head of a linked list of integers. Your task is to generate an m x n matrix by filling it in a spiral order (clockwise) using the integers from the linked list. If any spaces remain, fill them with -1.

Leetcode 2327: Number of People Aware of a Secret

On day 1, one person discovers a secret. Each person will share the secret after a delay and forget it after a certain number of days. Return the number of people who know the secret at the end of day n, modulo 10^9 + 7.