You are given an integer array ’nums’ of even length consisting of an equal number of positive and negative integers. Rearrange the array such that every consecutive pair of integers has opposite signs, the order of integers with the same sign is preserved, and the array begins with a positive integer.
You are given an integer array ’nums’ and a value ‘pivot’. Your task is to rearrange the elements in ’nums’ such that all elements less than ‘pivot’ appear before any element greater than ‘pivot’, and all elements equal to ‘pivot’ appear between the elements less than and greater than ‘pivot’. The relative order of the elements less than and greater than ‘pivot’ should be preserved.
You are given two arrays: spells and potions, representing the strength of spells and potions, respectively. Each element in the arrays represents the strength of a specific spell or potion. You are also given an integer success, which defines the minimum product of a spell and a potion required for a successful pair. For each spell, determine how many potions can pair with it to form a successful combination (i.e., their product is greater than or equal to success).
You are given two arrays representing bus departure times and passenger arrival times, along with the maximum capacity of each bus. The task is to determine the latest time you may arrive at the bus station to catch a bus. You cannot arrive at the same time as another passenger.
You are given two strings start and target, each consisting of the characters 'L', 'R', and '_'. The goal is to check if it is possible to transform the string start into target by moving the ‘L’ and ‘R’ characters. ‘L’ can only move to the left and ‘R’ can only move to the right. A blank space can be occupied by either ‘L’ or ‘R’.
You are given a strictly increasing array of integers, nums, and a positive integer diff. A triplet (i, j, k) is an arithmetic triplet if the following conditions hold: i < j < k, nums[j] - nums[i] == diff, and nums[k] - nums[j] == diff. Your task is to return the number of unique arithmetic triplets that can be formed from the given array.