All Posts

Leetcode 2501: Longest Square Streak in an Array

You are given an integer array nums. A subsequence of nums is called a square streak if its length is at least 2, and after sorting the subsequence, each element (except the first one) is the square of the previous number. Return the length of the longest square streak in nums, or -1 if no square streak exists.

Leetcode 2513: Minimize the Maximum of Two Arrays

Given two integers divisor1 and divisor2, and two integers uniqueCnt1 and uniqueCnt2, construct two arrays such that: arr1 contains uniqueCnt1 distinct integers that are not divisible by divisor1, arr2 contains uniqueCnt2 distinct integers that are not divisible by divisor2, and no integer appears in both arrays. Return the smallest possible maximum integer in either array.

Leetcode 2517: Maximum Tastiness of Candy Basket

You are given an array of positive integers price where price[i] denotes the price of the i-th candy and a positive integer k. The store sells baskets containing k distinct candies. The tastiness of a candy basket is defined as the smallest absolute difference between the prices of any two candies in the basket. Your task is to return the maximum tastiness of a candy basket that can be formed by selecting k distinct candies.

Leetcode 2529: Maximum Count of Positive Integer and Negative Integer

You are given an array of integers sorted in non-decreasing order. Your task is to determine the maximum count between the number of positive integers and the number of negative integers in the array. Zero is not considered positive or negative.

Leetcode 2540: Minimum Common Value

Given two integer arrays nums1 and nums2 sorted in non-decreasing order, return the smallest integer that is common to both arrays. If no such integer exists, return -1.

Leetcode 2554: Maximum Number of Integers to Choose From a Range I

You are given an array banned consisting of integers, an integer n, and an integer maxSum. Your task is to return the maximum number of integers you can select from the range [1, n] such that none of them are in the banned list and their sum does not exceed maxSum.