Tip 1 : Go through all the data structures
Tip 2 : Practice problems on codestudio.
Tip 3 : Give few mock interviews
Tip 1 : List out all your achievements and participation
Tip 2 : Have at least two projects on your resume
This round lasted for an hour and two questions were asked based on dsa. The first question dealt with sorting, while the second dealt with the concept of complete binary tree. I was able to solve both of the problems and advanced to the next round.
1. There will be no leading zeros in any string in the list ‘BINARYNUMS’.
Consider N = 5 and the list ‘binaryNums’= [“0”, “01”, “010”, “100”, “101”]. This list consists of the binary representation of numbers [0, 1, 2, 4, 5]. Clearly, the missing number is 3 and its binary representation will be “11”. So you should return string “11”.
brute force approach was to use linear search
the efficient approach was to apply binary search and check if the index is just one less than the number if it is greater than index+1 then we need to move left if it is equal then move right and find out the required answer
In the above complete binary tree, all the levels are filled except for the last. In the last level, all the nodes in the last level are as far left as possible.
brute force was to apply bfs and return the node which was popped out last
the efficient approach was to find the height of left subtree and right subtree and check if the node lies in the left part or right part recursively
In this round I was asked questions based on my SOP before the interviewer moved on to the dsa questions. The sliding window technique was used in the first question, while recursion and backtracking was used in second question.
Suppose given input is "abacb", then the length of the longest substring without repeating characters will be 3 ("acb").
I used the sliding window technique and pushed the first element to the map and before pushing the next element I checked if the element is already present or not if yes then I removed the first element and checked until we have elements which are all unique in the map and output the maximum size of the map.
For a given string “BaaB”
3 possible palindrome partitioning of the given string are:
{“B”, “a”, “a”, “B”}
{“B”, “aa”, “B”}
{“BaaB”}
Every substring of all the above partitions of “BaaB” is a palindrome.
I solved this using recursion and backtracking and partitioned the string from 0-k and k-length of string where k is the point of partition and checked how many partitions are palindrome and if a partition not forming palindrome then we'll backtrack and check for remaining partitions.
Here's your problem of the day
Solving this problem will increase your chance to get selected in this company
Which operator is used for exponentiation in Python?