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 a 0-indexed array ’nums’. A pair of integers ‘x’ and ‘y’ is called a strong pair if it satisfies the condition |x - y| <= min(x, y). Your task is to find two integers from ’nums’ that form a strong pair and have the highest possible bitwise XOR value among all strong pairs in the array. You can pick the same integer twice.
You are given a 2D array, access_times, where each entry contains an employee’s name and their system access time in 24-hour format (HHMM). An employee is considered ‘high-access’ if they accessed the system at least three times within any one-hour window. The task is to identify all such high-access employees and return their names.
You are given a string s and a positive integer k. A string is beautiful if it satisfies the conditions that the number of vowels equals the number of consonants, and the product of the number of vowels and consonants is divisible by k. Return the number of non-empty beautiful substrings in the string.
You are given two integer arrays, nums1 and nums2, with sizes n and m respectively. Your task is to find the number of indices i such that nums1[i] exists in nums2 and the number of indices i such that nums2[i] exists in nums1. Return both values as an array [answer1, answer2].