Tip 1 : Start with the basics if you have lost touch with competitive coding. Don't directly jump to interview questions.
Tip 2 : Create a timetable and set goals. Keep aside 3-4 hours for studying. Consistency is the key.
Tip 3 : Focus on medium and hard questions. Solving a lot of easy questions doesn't help.
Tip 1 : You should have good projects to showcase.
Tip 2 : Keep it clean and simple.
Two coding questions were asked and 90 minutes of time was allotted to solve both the problems
Sort the array and find the target sum with 2 pointer technique.
Solved it using BFS. Created a queue. First added the source cell to the queue and distance as 0. In the loop(with loop being empty as terminating condition.), popped a cell and distance. Added its neighboring cells containing 1 or 3 and distance+1. Marked the cells as visited.
If the popped cell is the destination, then returned the distance.
The duration was approx 1 hour. The interview was taken by a young SDE-2.
Solved using BFS. Maintained 2 queues this time, one for fire cells and another for movement cells.
Returned True if the person reaches an edge cell. Mark each firing cell, visited cell, and movement cell as 0 so that it is not added to the movement queue going ahead. Initially added all the fire cells to the fire queue. In one iteration, add the possible safe cells to the movement queue and...
The interviewer introduced himself and asked me to introduce myself.
I told him about the different projects that I had done and the work in the previous company.
I had worked on AWS(Amazon Web Services) so he asked me all the AWS services that I had worked with and to explain one of them.
I explained about the working of ECS(Elastic Container Service).
After this, he moved to the coding questions.
Solved using BFS. Initialize distances for all zeroes to be infinity. Add 0 cell to queue if the distance is less than the already calculated distance. Used extra loop for levels in BFS. When the queue gets empty, the last level gives the maximum distance
As we traverse the array, maintain another array that stores the last k elements in ascending order. Find the position of the current element in the sorted array and check the absolute difference between the preceding and next element. If the absolute difference is less than equal to t then return the two values. Remove element at i-k from sorted array.
Time Complexity: O( n log(k) ), where ...
The interviewer was a very senior person with at least 10-15 years of experience. He introduced himself and asked me to tell him about myself. (Leadership principle questions followed)
Solved using DFS. Similar to mirror trees. Pass root left and root right as arguments to the is _mirror_tree function. First explained the approach to the interviewer. He was satisfied and asked me to write code.
The interview started with introductions and some Leadership principle questions. The interviewer was again a senior person with at least 10-15 years of experience.
I was asked to explain some AWS services.
He asked me to tell about a time when I had a tight deadline and how I worked during it.
He asked me about a time when I took initiative and came up with something new which helped the entire team.
I had prepared well for the LP questions and was able to answer everything.
After this, we move on to coding questions.
Discussed the solution using the hash map. He was convinced and asked me to code. I wrote a well-commented code and he was happy with it.
I had solved it earlier and explained to him the approach using doubly Linked List and Hash map.
He was convinced with my approach and asked me to code it without using any in-built data types. He asked me to write classes. I had prepared the solution with classes and started writing the code.