All Posts

Leetcode 2767: Partition String Into Minimum Beautiful Substrings

Given a binary string ’s’, partition it into substrings such that each substring represents a power of 5 in binary form and does not contain leading zeros. Return the minimum number of such partitions, or -1 if impossible.

Leetcode 2768: Number of Black Blocks

Given an m x n grid with some black cells specified by a coordinates list, determine how many 2x2 blocks contain exactly 0, 1, 2, 3, or 4 black cells.

Leetcode 2780: Minimum Index of a Valid Split

Given a 0-indexed integer array nums of length n, an element x in nums is called dominant if freq(x) * 2 > n, where freq(x) is the number of occurrences of x in nums. It is guaranteed that nums contains exactly one dominant element. You can split nums into two non-empty subarrays at an index i such that the dominant element of the entire array is also the dominant element of both subarrays. Find the minimum index i where this condition holds, or return -1 if no such index exists.

Leetcode 2784: Check if Array is Good

Determine if an integer array nums is a permutation of a special array base[n], defined as [1, 2, …, n - 1, n, n], where 1 to n-1 appear once and n appears twice.

Leetcode 2799: Count Complete Subarrays in an Array

You are given an array ’nums’ consisting of positive integers. A subarray is called complete if the number of distinct elements in the subarray is equal to the number of distinct elements in the entire array. Return the total number of complete subarrays.

Leetcode 2808: Minimum Seconds to Equalize a Circular Array

You are given a 0-indexed array nums containing n integers. At each second, replace every nums[i] with either nums[i], nums[(i-1+n)%n], or nums[(i+1)%n]. Return the minimum number of seconds required to make all elements in the array equal.