All Posts

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.

Leetcode 2811: Check if it is Possible to Split Array

You are given an array nums and an integer m. You need to determine if it’s possible to split the array into n subarrays of size 1, following the rules that each subarray must either have length 1 or have a sum of elements greater than or equal to m.

Leetcode 2812: Find the Safest Path in a Grid

You are given a square grid of size n x n, where each cell contains either a thief (represented by 1) or is empty (represented by 0). You start at the top-left corner of the grid and must find the maximum safeness factor for a path to the bottom-right corner. The safeness factor is defined as the minimum Manhattan distance from any cell in the path to the nearest thief.

Leetcode 2815: Max Pair Sum in an Array

You are given an integer array nums, and you need to find the maximum sum of any two distinct numbers in the array such that the largest digit in both numbers is the same.

Leetcode 2817: Minimum Absolute Difference Between Elements With Constraint

You are given a 0-indexed integer array nums and an integer x. Find the minimum absolute difference between two elements in the array such that their indices are at least x apart.