Tip 1 : Must do Previously asked Interview as well as Online Test Questions.
Tip 2 : Go through all the previous interview experiences from Codestudio and Leetcode.
Tip 3 : Do at-least 2 good projects and you must know every bit of them.
Tip 1 : Have at-least 2 good projects explained in short with all important points covered.
Tip 2 : Every skill must be mentioned.
Tip 3 : Focus on skills, projects and experiences more.
I found the online coding round of Flipkart to be quite difficult based on the constraints of the problem and their time limits. I coded the first problem quite easily but on the second and the third problem , my code could only pass a few test cases and gave TLE for most of them. Both the questions required very efficient solution and the last 5 to 10 Test Cases carried more weight than the rest so I didn't get through this round.

1) It is guaranteed that the Kth digit from the right always exists.
2) It is also guaranteed that 'K' is always less than or equal to the number of digits in N ^ M.
3) 'N' and 'M 'can’t be a 0 simultaneously.
The idea here is to use the pow function to find N raised to the power M. After finding the power, we start removing the digits from the last until we get the kth digit.



There must be no consecutive horizontal lines of equal height in the output skyline. For instance, [...,[2 3], [4 5], [7 5], [11 5], [12 7],...] is not acceptable; the three lines of height 5 should be merged into one in the final output.
As such: [..., [2 3], [4 5], [12 7],...].
Also, the buildings are sorted by a non-decreasing order.
For more clarification see sample case 1.
Approach (Naive):
1) Store the coordinates and heights of the buildings paired up with each other with the first building coordinate paired after taking negative of the height and the second coordinate with positive height in a list ‘POINTS’.
2) Now, sort edges present in the ‘POINTS’ list (array) in ascending order.
3) The positions are now sorted from left to right, small to large. Now, initialise a dictionary named 'HEIGHTS' with zero as its first key, having a value of 1 since this would be the last height that would be added.
4) Now, for each pair of an edge in the ‘POINTS’ list (array) and check:
4.1) Update the dictionary if the current edge is a start edge (with negative height) increment the value
of the key by 1.
4.2) Delete the invalid buildings from the dictionary if an end edge is encountered for a key after
decrementing its value by 1.
4.3) Now, In each iteration update the 'SKYLINE', which records the highest building from some
position, and add it to the final list of our 'SKYLINE's if the current highest is no longer the tail of the
'SKYLINE' (previous highest).
5) We finally return the 'SKYLINE' list (array) that we have formed.
In the test , I could only figure out a O(N^2) solution and hence it gave TLE in the last 5 Test Cases. I later found out a O(N*log(N)) solution which could have passed all the test cases.
Approach (Efficient) :
1) Sort edges with [POSITION, -HEIGHT, VALID_UNTIL]. Here, the first two elements are for iterating edges with the correct sequence, while, the last one is for popping out invalid buildings during the iteration.
2) The positions are now sorted from left to right, small to large.
3) When positions are overlapped, sort the height from high to low, large to a small image
4) Now, for each edge:
4.1) Pop-out invalid buildings from the top of the heap (there might still exist invalid ones in the heap, but
we just want to make sure the top of the heap is valid).
4.2) And update the heap if the current edge is a start edge
4.3) In each iteration update the 'SKYLINE', which records the highest building from some position, if the
current highest is no longer the tail of the 'SKYLINE' (previous highest).
5) We finally return the 'SKYLINE' list (array) that we have formed.


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.
Approach :
1) Create a 2-D dp boolean vector(with all false initially) where dp[i][j] states whether s[i...j] is a palindrome or not and
initilialise a variable ans=1 which will store the final answer.
2) Base Case : For every i from 0 to n-1 fill dp[i][i]=1 ( as a single character is always a palindrome ) .
3) Now, run 2 loops first one from i=n-1 to i=0 (i.e., tarverse from the back of the string) and the second one from
j=i+1 to n .
4) For every s[i]==s[j] , check if(j-i==1 i.e., if s[i] and s[ j] are two consecutive same letters) or if(dp[i+1][j-1]==1 or not
i.e., if the string s[i+1,....j-1] is palindrome or not .
5) Because if the string s[i+1,....j-1] is a palindrome and s[i]==s[j] then s[i] and s[j] can be appended at the starting
and the ending position of s[i+1,...j-1] and s[i...j] will then be a palindrome , so mark dp[i][j]=1 and update the answer
as ans=max(ans , j-i+1).
6) Finally return the ans
TC : O(N^2) where N=length of the string s
SC : O(N^2)
In this question too , my code could only pass a few Test Cases . The constraints were quite tight.
I later found out that there is also a O(N) approach to this problem using Manacher's Algorithm but it was quite complex.

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?