Delhivery OA
CTC:- INR 8LPA + Benefits
Location:- India
Role:- Full Time SDE (Freshers)
Pattern ~10 Mcqs (related to CS Fundamentals) + 3 coding questions.
Time : 2hours.
Question 1:
You are given 2 numbers, (a , b). After each step you can transform it into (b-a, a+b). You have to print the values after the nth step. (Print values after taking mod 10^9 + 7)
Constraint
1<= a <= b < 10^9
1 <= n < 10^9
Sample:
I/p a = 2, b = 3, n = 1
o/p 1 5
Explanation 3-2 = 1 and 3+2 = 5
Question 2:
There are n items you need to shop. M shops sell all the n items. (To be clear each shop sells all the n items but at varying prices).
From each shop you have to buy n - 1 items. (It is mandatory to shop from all m shops and buy n-1 items from each shop). Each shop sells at varying prices.
What is the minimum cost to buy all the n items while satisfying the given conditions?
If you are not able to buy all n items print -1.
Constraints:
1<=N<=10000
1<=M<=10000
1<=Price<=1000
Question 3:
You are given an array of size N. You have to find the minimum subarray (that is a subarray with the smallest length) whose MEX value is greater than equal to K.
MEX : stands for Minimum Excluded Value.
Learn here :- wikipedia / Mex_(mathematics) [search google] (I can't put the link here, link in comment).
Note: print -1 if such subarray doesn't exist, else print the min length of the subarray satisfying the condition.
Constraints:
1<N<=10^6
0 <= K <= 1000
0<= A[i] <= 1000
PS
I was able to solve first 2 coding questions. I wasn't able to figure the last questions.
Please help, if you are able to figure out the last one.