You are given an array of non-negative integers. Your task is to count the number of ways the array can be split into three contiguous non-empty subarrays: left, mid, and right. The sum of the elements in the left subarray should be less than or equal to the sum in the mid subarray, and the sum of the mid subarray should be less than or equal to the sum of the right subarray. Return the number of such good splits modulo 10^9 + 7.
You are given an array nums where each element represents the number of balls in a bag. You can perform up to maxOperations operations, where each operation consists of splitting one bag of balls into two smaller bags. Each new bag must contain a positive number of balls. The goal is to minimize the maximum number of balls in any bag after performing the operations.
You are tasked with constructing an array nums of length n such that: all elements are positive integers, the difference between adjacent elements is at most 1, the sum of elements does not exceed maxSum, and the value at index index is maximized. Return the value at index in the array nums.
You are given two positive integer arrays nums1 and nums2 of the same length n. You are allowed to change at most one element of nums1 to any other value from nums1 to minimize the total absolute sum difference between nums1 and nums2. Return the minimum absolute sum difference after making the replacement. Since the answer may be large, return it modulo 10^9 + 7.
You are given an integer array nums and an integer k. In one operation, you can increment any element of the array by 1. Your task is to return the maximum possible frequency of any element after performing at most k operations.
You are given two non-increasing 0-indexed integer arrays nums1 and nums2. A pair of indices (i, j) is valid if both i <= j and nums1[i] <= nums2[j]. The distance of the pair is j - i. You need to return the maximum distance of any valid pair (i, j). If there are no valid pairs, return 0.