Tip 1 : Practice at-least 300 problems.
Tip 2 : Add at-least 2 projects and prepare them well for the interview.
Tip 3 : Practice mock interviews with your friends to learn how to explain problems.
Tip 1 : Follow some standard resume format and add 2-3 projects with explanations in point, also include technologies used in the project.
Tip 2 : Make sure you add all the technologies you are aware of in your resume and also, add links to competitive profiles (if you have good coding profiles).
Tip 3 : Add your achievements in the resume in points.
The interview started in the evening on google meet. and extended for 90 minutes. The interviewer was very helpful and he shared a collaborative code editor to discuss several problems.



We cannot use the element at a given index twice.
Try to do this problem in O(N) time complexity.
Step 1 : I first explained an iterative approach for the problem. The solution had O(N) complexity.
Step 2 : Interviewer asked me to optimise the solution.
Step 3 : Then I gave a solution that involved using binary search as the array was already in sorted order that reduced the solution complexity to O(log N) and the interviewer was happy.



Below is the example showing the input tree and its sum tree.

Step 1 : I explained a solution that involves calling nodes reclusively and calculating the sum of all children and adding them together to check the condition. After calculating I returned sum of children with the node value from the function.
The solution has time complexity of O(N) when N is number of nodes and the interviewer was happy with my approach.



1. put(U__ID, value): Insert the value in the cache if the key(‘U__ID’) 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 frequently used item before inserting the new item.
2. get(U__ID): Return the value of the key(‘U__ID’), present in the cache, if it’s present otherwise return -1.
1) The frequency of use of an element is calculated by a number of operations with its ‘U_ID’ performed after it is inserted in the cache.
2) If multiple elements have the least frequency then we remove the element which was least recently used.
Type 1: for put(key, value) operation.
Type 2: for get(key) operation.
We perform the following operations on an empty cache which has capacity 2:
When operation 1 2 3 is performed, the element with 'U_ID' 2 and value 3 is inserted in the cache.
When operation 1 2 1 is performed, the element with 'U_ID' 2’s value is updated to 1.
When operation 2 2 is performed then the value of 'U_ID' 2 is returned i.e. 1.
When operation 2 1 is performed then the value of 'U_ID' 1 is to be returned but it is not present in cache therefore -1 is returned.
When operation 1 1 5 is performed, the element with 'U_ID' 1 and value 5 is inserted in the cache.
When operation 1 6 4 is performed, the cache is full so we need to delete an element. First, we check the number of times each element is used. Element with 'U_ID' 2 is used 3 times (2 times operation of type 1 and 1-time operation of type 1). Element with 'U_ID' 1 is used 1 time (1-time operation of type 1). So element with 'U_ID' 1 is deleted. The element with 'U_ID' 6 and value 4 is inserted in the cache.
I used min-heap to implement LFU , as it handles insertion, deletion, and update in logarithmic time complexity. A tie can be resolved by removing the least recently used cache block. I also used an hashmap to store the indices of the cache blocks which allows searching in constant time.
The interviewer was happy with my solution
Write a SQL query to find X percentile of the student.
Tip 1 : Practice SQL queries from different websites.
Tip 2 : Use different websites for quick revision of common SQL commands.
Interviewer asked me about Polymorphism and about real time and run time polymorphism also with the examples.
Tip 1 : Read OOPs concepts thoroughly.

Here's your problem of the day
Solving this problem will increase your chance to get selected in this company
What is recursion?