Tip 1 : You should have excellent problem solving skills
Tip 2 : Code a lot.
Tip 3 : You should be thorough with your concepts of Data Structures and Algorithm.
Tip 4 : Know the complexities of the code that you’ve written.
Tip 1 : Mention your important projects in detail
Tip 2 : Keep it precise and concise
The online test consists of around 28 MCQs and 2 programming questions.
If the given arrays are [1, 2, 3] and [1, 2] then you need to return true as ARR2 is a subset of ARR1, but if the given arrays are [1, 2, 3] and [1, 2, 2] then you need to return false since ARR2 is not a subset of ARR1.
Let ‘N’ = 4, ‘Arr’ be [1, 2, 5, 4] and ‘K’ = 3.
then the elements of this array in ascending order is [1, 2, 4, 5]. Clearly, the 3rd smallest and largest element of this array is 4 and 2 respectively.
It was scheduled a week in advance. The interviewer was very kind and helpful.
Source node: 1
The farthest vertex in the above graph from vertex 1 is 2 via the route of vertex 3. So, the distance is 2.
It was a basic tree question. In my solution I used a global variable so the interviewer asked me to write a code where I am using the variable as an argument to the function.
1. get(key) - Return the value of the key if the key exists in the cache, otherwise return -1.
2. put(key, value), Insert the value in the cache if the key is not already present or update the value of the given key if the key is already present. When the cache reaches its capacity, it should invalidate the least recently used item before inserting the new item.
Type 0: for get(key) operation.
Type 1: for put(key, value) operation.
1. The cache is initialized with a capacity (the maximum number of unique keys it can hold at a time).
2. Access to an item or key is defined as a get or a put operation on the key. The least recently used key is the one with the oldest access time.
I used a vector and map.
The round consisted of 1 coding question and few c++ and oops concepts were asked.
The input string(STR) will not contain any spaces.
Assume that all characters in STR are lower case letters.
If characters less than 'K' remain, then append them in a sorted way to the new string.
Let the input string be "edcba" with K = 4.
Let the new string to be formed is initially empty, newString = "".
The first set of 4 characters are, ('e', 'd', 'c', 'b')
Out of these 4 characters, the smallest one is 'b' and hence we add it to the newString and it becomes,
newString = "b"
The next set of 4 characters are, ('e', 'd', 'c', 'a')
Out of these 4 characters, the smallest one is 'a' and hence we add it to the newString and it becomes,
newString = "ba"
Now we are left with "edc" and since we can't get a window of size 4, we sort them in the increasing order and append them to the newString.
Hence, newString thus formed will be "bacde".
I used a recursive method
I was asked 2 questions in this round along with some core concepts. This was my last round.
It is a standard question.
INPUT : ARR [ ] = [ 1 , 2 , 3 , 4 , 5 ] , N = 4
OUTPUT: ARR [ ] = [ 1 , 2 , 4, 5 ]
The above example contains an odd number of elements, hence the middle element is clearly the (N+1) / 2th element, which is removed from the stack in the output.
INPUT : ARR [ ] = [ 5, 6, 7, 8 ] , N = 3
OUTPUT: ARR [ ] = [ 5, 7, 8 ]
The above example contains an even number of elements, so out of the two middle elements, we consider the one which occurs first. Hence, the middle element would be ((N+1) / 2 - 1) element, which is 6 and is removed from the stack in the output.
I used a recursive approach.
Here's your problem of the day
Solving this problem will increase your chance to get selected in this company
What does print(2 ** 3) output in Python?