Uber Online assessment Sept 2020.

The Online assessment test was held on codesignal.

Q1. Given two arrays A[] and B[] containing positive integers and an integer 'd'.
we need to return the count of elements,A[i], in A[] that satisfies below condition
| A[i] - B[j] | > d (0<=j<n where n is size of B).
e.g.
Input : A = [7, 6, 9] B = [13, 1, 4] and d = 3
Output : 1
Explanation : For A[i] = 7, Difference | A[i] - B[j] | is greater than d for B[j] = 13, 1 but equal to 3 for B[j] = 4. Hence, 7 does not qualify.
Similary for 6, the differences are [7, 5, 2]. since 2 is less equal to 3 hence this element does not qualify as well.
Whereas for 9, the differences are [4, 8, 5]. here difference with each element of B is greater than d. So we have found 1 such element.
So the output would be 1.

Q2. Given an array A[] of integers and an integer m representing the size of sub-array.
We need to return maximum among the minimum elements of m-size sub arrays in A.

Comments (10)