Tip 1: Must-Solve DSA (FAANG LEVEL DSA).
Tip 2: Resume from Top to Bottom.
Tip 3: Detailed Projects.
Tip 1: DSA Coding Challenges
Tip 2: Impactful Experience
The interview was scheduled for the evening, around 5–6 PM. There were two people on the panel—one was actively conducting the interview, while the other was mostly shadowing the process. The main interviewer was an SDE-2 at PhonePe. The round began with a brief introduction and an overview of what to expect during the session. It was planned to last an hour and included two DSA questions. One required writing complete code along with test cases and executing it successfully. The second problem involved writing pseudocode and clearly explaining the approach.
Input: 'stones' = [[0,1] [1,0] [0,0]]
Output: 2
Explanation:
We can remove the 1st stone at [0,1] as it has the same row as the 3rd stone [0, 0]. And remove the 2nd stone because it has the same column [0,1] as the 3rd stone.
Uses DisJoint Set Union to Solve it.
Algorithm
Main method removeStones:
Set n as the length of the input array stones.
Create an instance of the UnionFind class uf with a size of 20002 to handle the coordinate range.
Loop through each stone i in stones:
Call uf.union() to union the x-coordinate (stones[i][0]) and the y-coordinate offset by 10001 (stones[i][1] + 10001).
Return n - uf.componentCount as our result.
Let 'N' = 5, 'A' = [1, 5, 2, 4, 3].
Here, if we take 'i' = 0, 'j' = 1, and 'k' = 3, then 'i' < 'j' < 'k' (0 < 1 < 3) and 'A[i]' < 'A[k]' < 'A[j]' (1 < 4 < 5).
Therefore, the answer is True.
The simplest solution is to consider every triplet (i, j, k) and check if the corresponding numbers satisfy the 132 criteria. If any such triplet is found, we can return True. If no such triplet is found, we need to return False.
Time Complexity: O(n^3).
The interviewer asked me to optimize this and gave me a hint to use a stack.
Almost the same as Round 1 for this.
The interview was scheduled in the evening, around 5–6 PM. There were two people on the panel—one interviewer was actively conducting the interview, while the other was mostly shadowing the process. The interviewer was working as an SDE-2 at PhonePe. The round began with a brief introduction and a quick overview of what to expect from the session. It was planned for an hour and included two DSA questions. One of them required writing complete code along with test cases and executing it successfully. The second problem involved writing pseudocode and clearly explaining the approach.
Let 'N' = 2, 'M' = [3, 1], 'O' = 5.
Day 1: Machine 2 produces an item
Day 2: Machine 2 produces an item
Day 3: Both Machine 1 and Machine 2 produce an item
Day 4: Machine 2 produces an item
Total items produced = 1 + 1 + 2 + 1 = 5 items.
Therefore, the answer is 4 days.
Can be solved using Binary Search
Approach
1. Sort the machines in ascending order of their production times.
2. Initialize left and right pointers for binary search.
3. While the left pointer is less than or equal to the right pointer:
Calculate the mid-value.
Determine how many items each machine can produce in mid days.
Sum up the total production from all machines.
Update left or right pointers based on the total production.
1. Return the final answer by doing a mod with 10^9 + 7.
2. Pairs {A, B} and {B, A} are considered the same.
For n-th person there are two choices:
1) n-th person remains single, we recur for f(n – 1).
2) n-th person pairs up with any of the remaining n – 1 persons. We get (n – 1) * f(n – 2).
Therefore we can recursively write f(n) as: f(n) = f(n – 1) + (n – 1) * f(n – 2).
We can simply form the recursive function for it with base case if n<=2 then f(n) = n as f(1)=1 and f(2)=2.
This round was conducted with the Hiring Manager, who was working as an Engineering Manager at PhonePe with over 7 years of experience. He came across as a very humble and approachable person. After a brief and formal introduction, he started by explaining the context and objective of the interview. The focus of this round was primarily to understand my past work experience, my expectations from the role and organization, and to share insights into what the company is looking for in a candidate. It was a blend of a culture fitment and team alignment round, aimed at ensuring mutual compatibility in terms of work style, values, and expectations.
Here's your problem of the day
Solving this problem will increase your chance to get selected in this company
Which traversal uses a queue as its primary data structure?