You have n balls placed on a table, each either black or white, represented by a binary string s. In each move, you can swap two adjacent balls. Your task is to determine the minimum number of swaps required to move all black balls to the right side and all white balls to the left side.
You are given a grid with n + 2 horizontal bars and m + 2 vertical bars, creating 1x1 unit cells. You can remove some bars from the given arrays hBars (horizontal bars) and vBars (vertical bars). The remaining bars are fixed and cannot be removed. Your task is to determine the maximum area of a square-shaped hole that can be formed in the grid after removing some bars.
You are given a list of integers ‘prices’, where each element ‘prices[i]’ represents the cost to purchase the ‘i’-th fruit. If you buy the ‘i’-th fruit at prices[i] coins, you get all subsequent fruits for free. Your task is to determine the minimum number of coins required to purchase all the fruits.
You are given an m x n matrix ‘mat’ and an integer ‘k’. The rows of the matrix undergo cyclic shifts: even-indexed rows shift left, and odd-indexed rows shift right. After performing these k shifts, determine if the matrix is identical to its original form.
You are given a list of integers, nums, and a positive integer limit. In each operation, you can choose two indices i and j and swap the elements at these indices if the absolute difference between nums[i] and nums[j] is less than or equal to the given limit. Your task is to return the lexicographically smallest array that can be obtained after applying the operation as many times as needed.
You are given a list called mountain, which contains integers. Your task is to find all the indices that represent peaks in the list. A peak is defined as an element that is strictly greater than its immediate left and right neighbors. The first and last elements of the list cannot be peaks. Return a list of indices that correspond to the peaks in the mountain array.