Tip 1: Be consistent in your preparation and practice.
Tip 2: Maintain daily problem-solving streaks on online coding platforms.
Tip 1: You don’t need to upload a resume since they use their own POD software to generate one automatically. Make sure to fill in all your details carefully while applying.
Tip 2: Avoid entering any fake marks, as they verify them with your college and will eliminate you before the first round if any discrepancies are found.
Round 1 was an online objective test consisting of 35 multiple-choice questions to be completed in 50 minutes. The questions were based on C++ concepts, pointers, data structures, OOPs, and output-based problems. Negative marking was also applied.
Round 2 included two DSA coding problems based on Linked List and Binary Tree, along with a few aptitude questions to test logical and analytical skills.

The sum of an empty subtree (i.e., if a child is null) is considered to be 0.
A leaf node has a left subtree sum of 0 and a right subtree sum of 0.
Start Recursion from Root: Begin a recursive function that returns the sum of the subtree rooted at the current node.
Base Case: If the node is NULL, return 0.
Recursive Call: Calculate the sum of the left and right subtrees recursively.
Compare Sums: Check if both left and right subtree sums are equal to the current node’s value.
Update Count: If the condition is satisfied, increment a reference counter.
Return Subtree Sum: Return the sum of left + right + current node’s value to the parent call.

The value of the 1st node should be updated to (Value of Last Node) - (Original Value of 1st Node).
The value of the 2nd node should be updated to (Value of 2nd to Last Node) - (Original Value of 2nd Node).
The value of the 3rd node should be updated to (Value of 3rd to Last Node) - (Original Value of 3rd Node).
...and so on.
Find the Middle Node: Use the slow and fast pointer technique to locate the middle of the linked list.
Reverse the Second Half: Reverse the second half of the linked list so that the last node comes first.
Two-Pointer Traversal: Initialize two pointers — one at the start of the first half, and one at the start of the reversed second half.
Update Values: For each pair of nodes, update the first half node’s value as:
first_pointer->val = second_pointer->val - first_pointer->val
Move Pointers Forward: Move both pointers to the next nodes until all nodes in the first half are updated.
Restore Order: Reverse the second half again to restore the original linked list order.
This test was conducted during the day and followed the previous rounds. It was purely DSA-based, consisting of three coding problems.



Input: ‘asteroids’ = [3,-2,4]
Output: [3, 4]
Explanation: The first asteroid will destroy the second asteroid. Hence, after the collision, the state of the asteroids will be [3,4].
You don’t need to print anything. Just implement the given function.
I solved this with stack based approach as which is its famous approach. I was well aware with its solutions and directly solved it.

If a level has two or more unique node values (e.g., [5, 5, 3]), the second largest is the second highest distinct value (in this case, 3).
If a level has fewer than two unique node values (e.g., [10] or [20, 20, 20]), there is no second largest value. In such cases, you should use -1 as a placeholder for that level's result.
Initialize Two Arrays: Create two arrays — one to store the largest value at each level and another to store the second largest value.
Recursive Function for First Largest: Traverse the tree recursively level by level, and update the largest value for each level in the first array.
Recursive Function for Second Largest: Traverse the tree again, comparing each node’s value with the largest value of its level. Update the second largest array if the node’s value is less than the largest but greater than the current second largest.
Combine Results: After both traversals, the second array will contain the second largest value at each level.
Return or Print: Use this array as the final result for all levels.

All nodes with values less than X come first.
All nodes with values equal to X come next.
All nodes with values greater than X come at the end.
Create Three Dummy Lists: Initialize three separate linked lists — less, equal, and greater.
Traverse Original List: Iterate through the original linked list and append each node to the appropriate list based on its value relative to X.
Connect Lists: Link the three lists in order: less → equal → greater.
Return Head: Return the head of the newly combined list as the final rearranged linked list.
This was first OA round at company and based on DSA. I was only able to solve one question due to some compiler issue, but still got selected.



Input: 'list' = [1, 2, 3, 4], 'k' = 2
Output: 2 1 4 3
Explanation:
We have to reverse the given list 'k' at a time, which is 2 in this case. So we reverse the first 2 elements then the next 2 elements, giving us 2->1->4->3.
All the node values will be distinct.
Unable to clear testcase due to some compiler issues.
Started around 11 AM, interviewer was 2.5 years experienced. Directly jumped into DSA problems after intro.




Define Recursive Function: Use a recursive function that returns a pair containing:
A boolean indicating whether the subtree rooted at the current node is a univalue subtree.
The count of univalue subtrees in the current subtree.
Base Case: If the node is NULL, return (true, 0) — an empty tree is considered univalue.
Recursive Calls: Recursively check the left and right subtrees, obtaining their boolean status and counts.
Check Current Node:
If both left and right subtrees are univalue and the node’s value matches its children (if they exist), then the current subtree is univalue.
Otherwise, it’s not.
Update Count:
Add the counts from left and right subtrees.
If the current subtree is univalue, increment the count by 1.
Return Pair: Return (isUnivalueSubtree, totalCount) to the parent call.

Define Recursive Function:
Use a recursive function that returns a pair containing:
Boolean: Whether the current node satisfies the balance condition.
Integer: The sum of all nodes in the subtree rooted at this node.
Base Case:
If the node is NULL, return (true, 0) — an empty subtree is balanced with sum 0.
Recursive Calls:
Recursively calculate the left subtree and right subtree, obtaining their boolean status and sums.
Check Current Node Balance:
Compute the absolute difference between the sum of left subtree and sum of right subtree.
Check if this difference ≤ K.
Combine Results:
If the left and right subtrees are balanced and the current node satisfies the balance condition, the current subtree is balanced.
Otherwise, it’s not.
Compute Total Sum:
Sum = leftSum + rightSum + currentNodeValue
Return Pair:
Return (isBalanced, totalSum) to the parent node.
This was also DSA round, interviewer was 4 years experienced. After intro, directly jumped into DSA problems.



• The left subtree of a node contains only nodes with data less than the node’s data.
• The right subtree of a node contains only nodes with data greater than the node’s data.
• Both the left and right subtrees must also be binary search trees.
Given binary tree:

In the given binary tree, subtree rooted at 2 is a BST and its size is 3.
1. Use a helper class `treeNode` to store `isBst`, `size`, `mini`, and `maxi` for each subtree.
2. Recursively traverse the tree in a **post-order** manner.
3. For each node, check if left and right subtrees are BSTs and satisfy `left->maxi < node->data < right->mini`.
4. If yes, update the subtree size, min, max, and `maxSize`. Otherwise, mark it as not BST.
5. Return the updated `treeNode` info to the parent.
6. The final `maxSize` after recursion is the size of the largest BST.


Input: ‘arr’ = [1, 1, 2] and ‘k’ = 2
Output: 2
Explanation: If we want to make two subarrays, there are two possibilities: [[1], [1, 2]] and [[1, 1], [2]]. We can see that the maximum sum of any subarray is minimized in the second case. Hence, the answer is 2, which is the maximum sum of any subarray in [[1, 1], [2]].
1. Set `low = max(weights)` and `high = sum(weights)`.
2. Perform binary search: pick `mid = (low + high)/2` as candidate max weight.
3. Check if weights can be distributed among `K` students without exceeding `mid`.
4. If possible, try smaller `mid` (`high = mid - 1`); otherwise, try larger (`low = mid + 1`).
5. Return the smallest feasible `mid` as the answer.
This was also a pure DSA round, interviewer was 14 years experienced. This was a hard level DSA round and some discussion on projects too. Highly optimised approaches were required. Interviewer was helpful and gave many hints to solve problems.



Input: 'str' = "aaccb"
Output: 2
Explanation: We can make a valid partition like aa | cc | b.
Precompute Palindromes:
Create a 2D boolean array isPalindrome[i][j].
isPalindrome[i][j] = true if substring s[i..j] is a palindrome.
Fill this array using dynamic programming / tabulation.
Initialize Cuts Array:
Create an array minCuts[i] to store the minimum cuts needed for substring s[0..i].
Calculate Minimum Cuts:
For each i from 0 to n-1:
If s[0..i] is palindrome → minCuts[i] = 0.
Else, try all j < i and check if s[j+1..i] is palindrome:
minCuts[i] = min(minCuts[i], minCuts[j] + 1)
This gives the minimum cuts for s[0..i].
Return Result:
minCuts[n-1] gives the minimum number of cuts for the entire string.

Case 1: Linked List with left and right pointers (O(n) time, O(1) space)
Find the Middle Node:
Use the slow and fast pointer technique on the linked list to find the middle node.
This node becomes the root of the BST.
Recursive Construction (In-Place):
Recursively apply the same method to the left half of the list → becomes left subtree.
Recursively apply the same method to the right half → becomes right subtree.
Link Subtrees:
Connect the left and right subtrees to the root.
Result:
BST is constructed in-place in O(n) time and O(1) extra space (ignoring recursion stack).
Case 2: Linked List without left and right pointers
The approach was explained recursively:
Find the middle node of the linked list to act as root.
Recursively construct the left and right subtrees from the two halves of the list.
No extra data structures were used; recursion handled the construction.
No code was required for this follow-up; only the recursive strategy was explained.
In the HR round, the interviewer highlighted that they were impressed with my DSA skills. They asked about my daily routine, how I would resolve conflicts with teammates, and my understanding of the company culture. The HR also explained the bond conditions and other policies of the company.

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