You are given an array of digit strings nums and a target digit string target. Count the number of valid pairs of indices (i, j) where i != j such that the concatenation of nums[i] and nums[j] equals target.
You are given a string answerKey where each character represents a question’s answer (either ‘T’ for True or ‘F’ for False), and an integer k. You are allowed to change at most k answers. Your task is to find the maximum number of consecutive ‘T’s or ‘F’s in the string after performing at most k changes.
You are given an array of m observations, each representing a die roll from a 6-sided die, and an average value mean of all n + m rolls. Your task is to calculate the missing n observations such that the overall average of all n + m rolls equals the provided mean. If multiple valid answers exist, return any of them. If it is impossible to achieve the desired average, return an empty array.
Alice and Bob are playing a game with stones. The sequence of n stones has values given in an array stones. Players take turns to remove a stone. The player who removes a stone, making the sum of all removed stones divisible by 3, loses. If all stones are removed, Bob wins automatically. Determine if Alice wins or Bob wins, assuming both play optimally.
You are given a 2D grid of integers, and an integer x. In each operation, you can either add x or subtract x from any element in the grid. Your task is to transform the grid into a uni-value grid, where all elements are equal. Return the minimum number of operations needed to achieve this, or return -1 if it is not possible.
You are given a stream of stock price records, where each record contains a timestamp and the corresponding price of the stock. The records may not be in order, and some records may contain errors that need to be corrected. Your task is to design an algorithm that updates the stock price at a given timestamp, finds the current price at the latest timestamp, and also finds the maximum and minimum prices the stock has been based on the current records.