You are given an array of positive integers arr. Perform a series of operations (possibly none) on arr to make it satisfy the following conditions: The value of the first element in arr must be 1, and the absolute difference between any two adjacent elements must be less than or equal to 1. You can decrease the value of any element and rearrange the elements in any order. Return the maximum possible value of an element in arr after performing the operations.
You are given an array nums, along with two integers target and start. Your task is to find an index i such that nums[i] == target, and the absolute difference between i and start is minimized. Return abs(i - start), where abs(x) is the absolute value of x.
You are given a 2D array logs where each entry represents the birth and death years of a person. You need to determine the earliest year that has the maximum population, where population is defined as the number of people alive in a given year.
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.
You are given an m x n matrix of characters box, where each cell is a stone (#), a stationary obstacle (*), or an empty space (.). After rotating the box 90 degrees clockwise, gravity will cause stones to fall down until they land on an obstacle, another stone, or the bottom. Return the updated matrix after the stones have fallen.
You are given an array of integers nums. The XOR total of an array is defined as the bitwise XOR of all its elements, or 0 if the array is empty. For every subset of nums, calculate the XOR total and return the sum of all XOR totals.