Tip 1: Be consistent with DSA practice.
Tip 2: Try to solve questions on your own before looking at the solution.
Tip 3: Analyse the time and space complexity of your solution.
Tip 1: Keep your past experience and internships authentic.
Tip 2: Clearly define your project’s motivation and scope for improvement.
The interview was conducted on the Karat platform. The interviewer introduced himself and then moved straight to the coding questions.
First, he showed me a code snippet and asked me to identify the error in it.
Second, he showed a problem along with the solution code and asked me to name the algorithm and describe its time complexity.
Third, he asked a DSA problem.
In the code for Dijkstra's shown, the condition to change the distance of node was not correct.



For the array [50, 21, 9], if we follow 1-based indexing, the Reverse Pairs are (1, 2), (1, 3) and (2, 3). Thus, the total count i.e. the answer becomes 3.
A single index of the pair (i, j) can be used multiple times.
I applied the brute force
First, we will run a loop(say i) from 0 to N-1 to select the a[i].
As index j should be greater than index i, inside loop i, we will run another loop i.e. j from i+1 to N-1, and select the element a[j].
Inside this second loop, we will check if a[i] > 2*a[j] i.e. if a[i] and a[j] can be a pair. If they satisfy the condition, we will increase the count by 1.
Finally, we will return the count i.e. the number of such pairs.

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