Tip 1 : First Go through all the concepts of Data Structures and algorithms, I have taken Coding ninjas course c++ interview preparation.
Tip 2 : Try to solve all the problems by yourself then it will be meant for you, if you can't solve them after 30-45 minutes of time then see the solution of it, and for this, I used to consult TA and mentors on coding ninjas course.
Tip 3 : Have confidence in yourself, if you can't solve it initially, gradually you will be able to solve the problems. Hard work pays off.
Tip 4 : Note down the main information's about your project like what you have done in the project and what difficulties you have faced, it will be a great way to tackle questions about the project in the interview.
Tip 1 : Keep it simple and mention what you actually know and achieved.
Tip 2 : Mention your institute email-id if you have, it adds weight to the resume
Tip 3 : Use the "Built/created/made X using Y to achieve Z" format when writing about projects or work done.
First Sort the price array. For finding the minimum amount start purchasing candies from starting and reduce k free candies from last with every single purchase. For finding the maximum amount start purchasing candies from the end and reduce k free candies from starting in every single purchase.
1. If there is no middle node in the list...
Step 1 : Take two pointers
Step 2 : Initialize both pointers to the head node and iterate one pointer by two and one by just one step
Step 3 : The pointer which is iterating by one step will reach the mid when other will reach the end.
Step 4 : Delete the mid pointer(which reached the mid).
Step 1 : To compute the rank of the element first make a copy of given arr then sort that copied array in ascending order.
Step 2 : Then traverse in the copied array and put their rank in HashMap by taking a rank variable.
Step 3 : If the element is already present in HashMap then don’t update rank otherwise update rank of the element in HashMap and increment rank variable as well.
If the input tree is as depicted in the picture:
We can keep track of the level of a node by passing a parameter to all recursive calls. The idea is to keep track of the maximum level also. Whenever we see a node whose level is more than the maximum level so far. We print the node because this is the first node in its level (Note that we traverse the left subtree before the right subtree).