Tip 1 : For DSA questions in interviews, start explaining from the brute force approach and then move to the optimal one. Convey your thought process to the interviewers, so that they can help you out if you get stuck. Communication skills matter a lot, and I think that is what makes the difference!
Tip 2 : Do some research about the company you are interviewing for and prepare the answers to the questions like Why should we hire you? (frame your answer in such a way that shows that your career goals align with the goals of the company), Why XYZ company?, Competitors of XYZ, etc. beforehand. Read about some latest news related to the company so that you can ask questions based upon that when the interviewer allows you to ask any question. This shows that you are genuinely interested to work for the company.
Tip 3 : Spend proper time making your resume and get it reviewed by seniors. Do not write anything that you are not confident of. Even if you write something that you don’t know, just be prepared that how you will defend it. The interviewers are much much experienced than you and they’ll catch you easily if you lie. So don’t take risks here.
Tip 1 : Try to include at least 1 development project in your resume.
Tip 2 : Do not write anything that you are not confident of. Even if you write something that you don’t know, just be prepared that how you will defend it.
This round was scheduled for 8 Oct 2021 from 9:00 pm. It was an online coding assessment round that consisted of 3 DSA questions.

0011 , 1100 , 101010 etc are beautiful strings whereas 1110, 0001,10101 etc are not beautiful strings.
Let the given string be “101001”
We will return 3 as we can divide the string into 3 beautiful strings “10” “10” and “01’.
The idea was to calculate the count of 1s between every two consecutive 0s of the string.



Input: 'a' = [7, 12, 1, 20]
Output: NGE = [12, 20, 20, -1]
Explanation: For the given array,
- The next greater element for 7 is 12.
- The next greater element for 12 is 20.
- The next greater element for 1 is 20.
- There is no greater element for 20 on the right side. So we consider NGE as -1.



You are given AIRPORTS = [1, 1, 1, 0, 1, 0], ‘K’ = 2 and ‘X’ = 4.
The answer will be 1. The plane makes its first stop at (2, 0) and then reaches the destination (4, 0) in the next fight. Hence the total number of stops is 1.
This round was scheduled for 26 Oct 2021 from 11:00 am. It was a technical interview round where I was asked questions from my resume and questions based on DSA.



insert(X): Inserts an element X in the data structure and returns true if the element was not present, and false otherwise.
remove(X): Removes the element X from the data structure, if present. Returns true if the element was present and false otherwise.
search(X): Search the element X in the data structure. Returns true if the element was present and false otherwise.
getRandom(): Return a random element present in the data structure.
Type 1: for insert(X) operation.
Type 2: for remove(X) operation.
Type 3: for search(X) operation.
Type 4: for getRandom() operation.
It is guaranteed that at least one element will be present in the data structure when getRandom() operation is performed.
Can you implement every operation such that it works in O(1) time?
Step 1 : I explained the O(n) approach to the interviewer by using an array.
Step 2 : I optimized the previous approach to O(1) using a hashmap and explained the same to the interviewer.
Step 3 : The interviewer asked me to code my approach on a shared coding editor.



A pair ('ARR[i]', 'ARR[j]') is said to be an inversion when:
1. 'ARR[i] > 'ARR[j]'
2. 'i' < 'j'
Where 'i' and 'j' denote the indices ranging from [0, 'N').
Step 1 : I explained the O(n*n) approach to the interviewer by using an array.
Step 2 : I optimized the previous approach to O(n) using the merge sort algorithm and explained the same to the interviewer.
Step 3 : The interviewer asked me to code my approach on a shared coding editor.



1. Buying a stock and then selling it is called one transaction.
2. You are not allowed to do multiple transactions at the same time. This means you have to sell the stock before buying it again.
Input: ‘n’ = 7, ‘prices’ = [3, 3, 5, 0, 3, 1, 4].
Output: 6
Explanation:
The maximum profit can be earned by:
Transaction 1: Buying the stock on day 4 (price 0) and then selling it on day 5 (price 3).
Transaction 2: Buying the stock on day 6 (price 1) and then selling it on day 6 (price 4).
Total profit earned will be (3 - 0) + ( 4 - 1) = 6.
Step 1 : I gave a recursive approach to solving this question. The recursive relation will be like this: maxProfit = max( P[left]*k + solve(P, k+1, left+1, right), P[right]*k + solve(P, k+1, left, right-1) ).
Step 2 : I optimized the previous approach to using memoization and explained the same to the interviewer.
Step 3 : The interviewer asked me to code my approach on a shared coding editor.

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