Education + Jobs Hiring Website - 2025
0 like 0 dislike
24 views
Gave OA for Agoda recently,in one hour the inviewer asked 2 questions:

 

It was to reduce priorities to the next minimum but maintain order and the limit was 0 to 99. Example:

Input: [2,3,2,6]

Output: [1,2,1,3]

Firstly i solved it with O(nlogn) complexity and it passed all the test cases but then he asked me to think of something better, and gave me a hint so i ended up telling him an algo which will reduce the TC to o(n) using an priority array as we know the priority window.

 

The problem wanted to compress the string but given frequency

Example: "abbcccb" with limit as 3 So the answer ould be "a"

Example: "aba",2 answer would be "aba"

I got little confused here and tried brute force but ended up submitting a better solution with stack.

 

Overall it went good. And they asked to me next round
ago in Online Assessments by Expert (136,160 points) | 24 views

Please log in or register to answer this question.