The test consisted of 3 questions on hackerearth platform of 50, 75 and 100 points respectively.
Given two arrays A and B of size n. Perform atmost n operations of the following type:-
Pick an element in B(say Bi) and A(say Ai) and set Ai=Ai+Bi or Ai=Ai* Bi.
Each element in B can be picked atmost once but elements in A can be selected multiple times. Maximize the product of all elements in array A after atmmost n operations.
Constraints:- 1<=n<=10^6 1<=A(i)<=10^6 1<=B(i)<=10^6
There are 3 types of operations in a search engine:-
Operation--> Input
Insert a string with frequency f--> I string frequency
Update the frequency of given string--> U string frequency
Query a prefix and find frequency of all elemets with given prefix--> Q string
For each query output the sum of frequency of all strings present.
Frequency<=10^4, Total Operations<=10^6, length of string<=30
Given a square matrix of side n, we are given a reward at each cell and another matrix with a probability for a negative event for each cell, find the maximum reward that can be collected starting from cell (0,0) to (n-1,n-1) with the sum of the probability of the individual cells less than a given threshold probability. At any cell we can go either down or right to an adjacent valid cell in the matrix.
Constraints:- n<=100
Feel free to share your approach so it can help others also.