You are given an array of strings garbage where each string represents the garbage collected at a specific house. The characters ‘M’, ‘P’, and ‘G’ represent metal, paper, and glass garbage, respectively. The time to collect one unit of garbage is 1 minute. You are also given an array travel where each element represents the time required to travel between two consecutive houses. Three trucks are responsible for picking up different types of garbage and can only travel sequentially from house 0 to the end. Each truck only collects one type of garbage and each truck can only be used one at a time. Return the minimum time required to pick up all the garbage.
An integer n is considered strictly palindromic if, for every base b between 2 and n - 2 (inclusive), the representation of n in base b is a palindrome. A number is palindromic in a base if the string representation of that number in that base reads the same forward and backward. Your task is to determine if the given integer n is strictly palindromic or not.
You are given a binary matrix matrix of size m x n and an integer numSelect. Your goal is to select exactly numSelect distinct columns from the matrix such that you cover as many rows as possible. A row is considered covered if all the 1’s in that row are included in the selected columns. If a row has no 1’s, it is also considered covered.
You are standing at a starting position startPos on an infinite number line, and you need to reach a destination endPos in exactly k steps. In each step, you can move either one position to the left or one position to the right. Your task is to find the number of different ways to reach endPos from startPos in exactly k steps. Since the number of ways can be very large, return the result modulo 10^9 + 7.
You are given an array nums consisting of positive integers. A subarray of nums is considered nice if the bitwise AND of every pair of elements, that are at different positions in the subarray, is equal to 0. Your task is to return the length of the longest nice subarray. A subarray is a contiguous part of an array, and subarrays of length 1 are always considered nice.
You are given a string s. Your task is to partition this string into the fewest number of substrings such that no character appears more than once in each substring. Each character must belong to exactly one substring in the partition.