You are given an array of integers called nums. A mountain triplet consists of three indices (i, j, k) such that i < j < k, nums[i] < nums[j], and nums[k] < nums[j]. Your task is to return the minimum possible sum of any such mountain triplet. If no such triplet exists, return -1.
You are given an array of integers called nums. A mountain triplet consists of three indices (i, j, k) such that i < j < k, nums[i] < nums[j], and nums[k] < nums[j]. Your task is to return the minimum possible sum of any such mountain triplet. If no such triplet exists, return -1.
You are given a collection of balls, each marked with a number. Your task is to sort the balls into boxes in a way that follows two rules: Balls with the same number must be placed in the same box, but if there are multiple balls with the same number, they can be placed in different boxes. Additionally, the biggest box can only have one more ball than the smallest box. Return the fewest number of boxes required to sort these balls while following these rules.
You are given a 0-indexed integer array nums. A subarray of nums is a contiguous sequence of elements. The distinct count of a subarray is defined as the number of unique values within that subarray. Your task is to return the sum of the squares of the distinct counts for all possible subarrays of nums.
You are given an array of integers nums and a target sum target. Your task is to find the length of the longest subsequence from nums that sums up to target. A subsequence can be derived by deleting some or no elements from nums while maintaining the original order of the remaining elements. If no such subsequence exists, return -1.
You are given an integer array nums and an integer k. We define the K-or operation as follows: for each bit position, the bit in the result will be set to 1 if at least k numbers in the array nums have a 1 in that position. Return the K-or of the array nums.