Goldman Sachs | 8th October | Online Assessment | Analyst | GoodArray | Palindrome subsequences

Question · Posted Oct 2022

Question 1 GoodArray For a number N, a goodArray is the smallest possible array of only power of two (2^0, 2^1, ..., 2^k) such that the sum of all the numbers in the array sum up to N. For each query that consists of three integers l, r, m, find out the product of elements goodArray[l] through goodArray[r] modulo m when goodArray is sorted in non-decreasing order. Example For N = 26, queries = [[1, 2, 1009], [3, 3, 5]], ...

The full answer & interview discussion are available to premium members.

Log in Create a free account