Open In App

Pickyourtrail Interview Experience (SET 1)

Last Updated : 26 Feb, 2019
Improve
Improve
Like Article
Like
Save
Share
Report

ROUND 1 QUESTIONS
1. They asked me to implement Stack with
a). Push,
b). Pop
c). add K to bottom e elements
I don’t want to use in-built Stack that Java provides. Hence I wrote a class Stack and defined the functionalities for each of the above operations.
I used an array here to maintain stack. Basically it’s a Stack using Array.
For a). TC – O(1). Just add to the current free position (top) in the array and increment top.
b). TC – O(1). Decrement top and remove the element.
c). TC – O(e). Iterate bottom e elements (from 0 -> e) and increment by K.
2. Given n integers and value k, print total number of pairs such that,
for all pairs -> (a, b)
a) a < b
b) a + k == b
c) (a, b) should be unique.
For eq., for integers 1 1 2 2 2 and k = 1
You can have only 1 pair = (1, 2).
Because,
a). 1 < 2
b). 1 + k (1) == 2
I used Set to eliminate duplicates and gave the answer in <= O(n) solution.
Basically the tc is O(non-duplicates)
3. Given N integers (which contains duplicates ) in an array, make the array unique.
Constraints,.
1. You can only increment the values and you cannot decrement.
2. Make array unique in minimal number of increments such that the sum of total elements in the array has to be minimum.
The interview was dead easy.

First round feedback

————————
1. They gave me 3 programming questions and asked me to write code in a paper for all of them. I used Java programming language. I have mentioned the questions above here.
2. I gave efficient solutions for all the three in terms of TC and space complexity etc.. Basically for all those questions, you cannot optimize further.
3. Then they were discussing about the first round in a meeting room which was near me and I was able to overhear what they were discussing.
4. They were like, since this guy is from Amazon, they could not meet the salary requirements and hence they finalized to reject me. Seriously WHAT?

Self doubt I am having now -> What? Seriously Did I attend interview in an IT company?


Like Article
Suggest improvement
Previous
Next
Share your thoughts in the comments

Similar Reads