You are given two arrays arr1 and arr2 of integers, both having equal lengths. Calculate the maximum value of the expression: |arr1[i] - arr1[j]| + |arr2[i] - arr2[j]| + |i - j| for all pairs of indices i and j, where 0 <= i, j < arr1.length.
Given a 2D grid of 0s and 1s, return the number of elements in the largest square subgrid that has 1s on its border and 0s inside. If no such subgrid exists, return 0.
Alice and Bob are playing a game with piles of stones. Each pile contains a positive integer number of stones. On each player’s turn, they can take stones from the first X remaining piles, where 1 <= X <= 2M. The goal is to maximize the number of stones Alice can collect assuming both play optimally.
You are given an array nums of integers. A move consists of selecting any element and decreasing it by 1. A zigzag array is an array where either every even-indexed element is greater than its adjacent elements or every odd-indexed element is greater than its adjacent elements. Your task is to return the minimum number of moves required to transform the given array into a zigzag array.
You are given an array of strings words and a string chars. A string is considered ‘good’ if it can be formed using characters from chars where each character can be used at most once. Your task is to return the sum of the lengths of all ‘good’ strings in words.