Tip 1 : Practise Atleast 500 questions
Tip 2 : Do Atleast 3 projects
Tip 3 : Atleast 1 internship experience
Tip 1 : Add your coding background
Tip 2 : Add at least 3 projects and 1 internship experience
I first applied recursive approach. It was not good enough
I then applied DP approach and solved it using memoization.
maxProfit = 0
if price[i] > price[i – 1]
maxProfit = maxProfit + price[i] – price[i – 1]
maxProfit = 0;
if price[i] > price[i – 1]
maxProfit = maxProfit + price[i] – price[i – 1]
Search from left to right and maintain a max height of left and right separately, which is like a one-side wall of partial container. Fix the higher one and flow water from the lower part. For example, if current height of left is lower, we fill water in the left bin. Until left meets right, we filled the whole container.
create an auxiliary array and store the Inorder traversal of BST in the array. The array will be sorted as Inorder traversal of BST always produces sorted data. Once we have the Inorder traversal we can get the answer using 2 pointer approach
-Create two indices i and j, where i = 0 and j = n-1
-Run a loop until i is less than j.
-Check if i knows j, then i can’t be a celebrity. so increment i, i.e. i++
-Else j cannot be a celebrity, so decrement j, i.e. j–
-Assign i as the celebrity candidate
-Now at last check that whether the candidate is actually a celebrity by re-running a loop from 0 to n-1 and
constant...
Design an Api which implement 3 function:
1: Search in a list(Employees) on the basis of params
2: Add in a list
3: Remove from a list(with Employee ID)
Tip 1 : Have a grip on Low level designs
Tip 2 : Apply the concept of Oops