You are given two arrays of strings, ‘queries’ and ‘dictionary’, where each word has the same length. A word from the ‘queries’ array can be transformed into a word from the ‘dictionary’ array by making at most two edits. An edit involves changing any character in the word to another letter. Your task is to find all words from ‘queries’ that, after making at most two edits, can match some word in ‘dictionary’. Return the words in the same order they appear in the ‘queries’.
You are given a 0-indexed array ’nums’, where each element represents a target on a number line, and an integer ‘space’. A machine is available that can destroy all targets that can be represented by the formula nums[i] + c * space, where c is a non-negative integer. You need to choose an element from ’nums’ to seed the machine such that it destroys the maximum number of targets. Return the minimum value from ’nums’ that can seed the machine to destroy the most targets.
You are given three arrays: ‘creators’, ‘ids’, and ‘views’. Each index i corresponds to a video created by the creator ‘creators[i]’, with an id ‘ids[i]’, and a number of views ‘views[i]’. The task is to find the most popular creators based on the sum of views of all their videos and identify the id of their most viewed video. If multiple creators have the same popularity, return all of them. For each creator, if they have multiple videos with the highest view count, return the lexicographically smallest id of their most viewed video.
Given a positive integer n and a target sum, the task is to find the smallest non-negative integer x such that the sum of the digits of n + x is less than or equal to the given target. The solution is guaranteed to always be possible for the given constraints.
You are given an array of integers and an integer k. You need to find the maximum sum of all possible subarrays of length k, where all elements in the subarray are distinct. If no subarray meets the condition, return 0.
You are given an array of integers where each element represents the cost of hiring a worker. You need to hire exactly k workers by running k sessions. In each session, choose the worker with the lowest cost from either the first ‘candidates’ workers or the last ‘candidates’ workers. If there is a tie, choose the worker with the smallest index.