Uber OA | Oct 2020
Anonymous User
2342

Question - 1:

a * a matrix is divided into b * b small matrices, which require sorting according to the first missing positive integer in each b * b matrix. If there is a tie, Output in the original order.

Question -2:

for two arrays, a lower bound, an upper bounnd, calculate how many pair, to meet lower <= a [i] ** 2 + b [i] ** 2 <= upper
example: input: a = [2, 3], b = [3, 4], upper bound = 18, lower bound = 10

output: 3

Explanation:

2 * 2 + 3 * 3 = 13 (satisfy the conditions) 
2 * 2 + 4 * 4 = 20 (The conditions are not met)
3 * 3 + 3 * 3 = 18 (The conditions are met
3 * 3 + 4 * 4 = 26 (The conditions are not met)

Question -3:

For a string, find a prefix with a length greater than 2, and this prefix is ​​one palindrome.
Then delete this prefix from the string.
The remaining string repeats the previous operation, knowing that it cannot be performed.
For example: input: aaaabcbd output: d

Explanation:

aaaabcbd -> aaaa is the longest prefix, the length is greater than 2, and it is palindrome, so delete it, the remaining string is bbcd,

bcbd -> bcb is the longest prefix , length greater than 2, and is Palindrome, so to remove the rest of the string D

D -> D is Palindrome, but the length is less than 2, it can not continue to delete

Question -4:

Give a number, output the difference between the sum of all digits and the product of all digits.
For example: input 1, 2, 3, output: 0 Explanation: 1 * 2 * 3-(1 + 2 + 3) =0

Comments (9)