Tip 1 : Practice Leetcode throughly.
Tip 2 : Revise your core subjects.
Tip 3 : Do not ignore HLD system design, use GFG or Leetcode for this.
Tip 1 : Keep some projects in your resume, that helps in the interview conversation.
Tip 2 : Do not add flashy items like colourful borders to your resume.
This was an online coding round which consisted of 2 problems to be completed in 60 mins. The test was held in Microsoft's own coding platform which had an environment same as any other platform like Hackerank with support for most of the popular programming languages.



1. "ARR" can contain duplicates.
Input: 'N' = 4 , "ARR" = [5, 10 , 2] and 'K' = 3.
Output: 1
Explanation : Currently, the difference between the maximum and minimum element in the array is 10 - 2 = 8, which is greater than K (3).
So, we need to remove some elements. The optimal way to get our result is to remove 10. After removing 10, the difference between maximum and minimum is 5 - 2 = 3, which is less than or equal to K.


str = "ababc"
The longest palindromic substring of "ababc" is "aba", since "aba" is a palindrome and it is the longest substring of length 3 which is a palindrome.
There is another palindromic substring of length 3 is "bab". Since starting index of "aba" is less than "bab", so "aba" is the answer.
Let N be the length of the string S.
Step 1. The most naive solution can be to check if every substring of S is palindrome or not but the time complexity of this would be N^2 * N = N^3 which won't pass.
Step 2. I solved this using DP.
Step 3. Let dp[i][j] = 1 if the string from index i to j is a palindrome otherwise it's 0.
Step 4. The recurrence relation would be dp[i][j] = (dp[i+1][j-1] == 1 && S[i] == S[j])
Step 5. find the max value in dp. If suppose the max value is for dp[x][y] then the final answer would be y -x + 1. Return it.
The round was held at 1 pm and was over before 2. It was a Microsoft teams meeting and coding was done in a live editor link of which can be shared. The interviewer was very friendly and gave me the question after having a quick round of intro.



For the given tree:

The path 1 -> 3 -> 7 produces the maximum i.e, 11.



There are many ways to solve this problem. I solved it using a deque. Create a deque such that it is always sorted in desc order from left to right and size does not exceed K. This deque acts as our window. First add the starting K elements in the deque such that when adding a new element such that all the elements to the left of it should be greater than it, if not start removing elements from the start of the deque. This will always give the max element in a subarray of size K.
This was the second technical round and also penultimate one. This was held in the afternoon for 40 minutes. It started with one question and ended with some questions related to my resume and projects.



1. You can not slant the container i.e. the height of the water is equal to the minimum height of the two lines which define the container.
2. Do not print anything, you just need to return the area of the container with maximum water.

For the above Diagram, the first red marked line is formed between coordinates (2,0) and (2,10), and the second red-marked line is formed between coordinates (5,0) and (5,9). The area of water contained between these two lines is (height* width) = (5-2)* 9 = 27, which is the maximum area contained between any two lines present on the plane. So in this case, we will return 3* 9=27.
This is a very standard skyline problem For any 2 buildings we would want either the distance between them to be maximum or the height of each of them. Keep 2 pointers on the array, one on the the first element one on the last and keep track of the ans for this pair of pointers. If the element at the first pointer index is smaller than the last one, shift the first pointer by 1 to its right, otherwise shift the last pointer to its left by 1.
Repeat this process until the pointers meet at the same point.

Here's your problem of the day
Solving this problem will increase your chance to get selected in this company
How do you remove whitespace from the start of a string?