## Largest Pair of Points - Google Top Interview Questions

You are given a strictly increasing list of integers nums and a list of integers values, both of the same length. Find a pair i ≤ j that maximizes values[i] + values[j] + nums[j] - nums[i] and return the value. Constraints 2 ≤ n ≤ 100,000 where n is the length of nums and values Example 1 Input nums = [0, 1, 6] values = [-5, 5, 4] Output 14 Explanation Here we can pick i = 1 and j = 2 to get 5 + 4 + 6 - 1 Example 2 Input nums = [0, 3, 6] values = [-5,

View Solution →## Maximize Binary String Score - Google Top Interview Questions

You are given a binary string s containing "1"s and "0"s. Consider splitting the string into two non-empty substrings such that a + b = s. The score of this split is defined to be the sum of the number of "0"s in a plus the number of "1"s in b. Return the maximum score possible. Constraints 2 ≤ n ≤ 100,000 where n is the length of s Example 1 Input s = "001001110111" Output 10 Explanation We can split the string into "00100" + "1110111". Then, the score is 4 + 6 =

View Solution →## Maximize Social Distancing - Google Top Interview Questions

You are given a list of integers seats containing 1s and 0s. Each element seats[i] represents a seat and is either occupied if seats[i] = 1 or empty if seats[i] = 0. Given that there’s at least one empty seat and at least one occupied seat, return the maximum distance from an empty seat to the closest occupied seat. Constraints n ≤ 100,000 where n is the length of seats Example 1 Input seats = [1, 0, 1, 0, 0, 0, 1] Output 2 Explanation We can sit at seats[4]. E

View Solution →## Max Multiplied Pairings - Google Top Interview Questions

You are given two lists of integers nums and multipliers. Consider an operation where we remove any number in nums and remove any number in multipliers then multiply them together. Given that you must repeat this operation until one of the lists is empty, return the maximum sum of the multiplied numbers. Note that the integers may be negative, zero, and/or positive. Constraints 0 ≤ n ≤ 100,000 where n is the length of nums 0 ≤ m ≤ 100,000 where m is the length of multipliers

View Solution →## Minimize Amplitude After K Removals - Google Top Interview Questions

You are given a list of integers nums, and an integer k. Given that you must remove k elements in nums, return the minimum max(nums) - min(nums) value we can achieve. Constraints 1 ≤ n ≤ 100,000 where n is the length of nums k < n Example 1 Input nums = [2, 10, 14, 12, 30] k = 2 Output 4 Explanation If we remove 2 and 30 then we'd get [10, 14, 12] and 14 - 10 = 4.

View Solution →