All Posts
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 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.
Leetcode 2369: Check if There is a Valid Partition For The Array
You are given a 0-indexed integer array, and you need to partition it into one or more contiguous subarrays. A partition is valid if each subarray meets one of the following conditions:
- The subarray contains exactly 2 equal elements.
- The subarray contains exactly 3 equal elements.
- The subarray contains exactly 3 consecutive increasing elements, where the difference between adjacent elements is 1. Return true if there is at least one valid partition in the array, otherwise return false.