Tip 1: Don't look at the solution for DSA questions straight away. Spend some time, look at the approach, and data structures used in the solution, and then write your code. This will improve your problem-solving skills.
Tip 2: Object Oriented Programming is very important. Learn it in depth and keep revising
Tip 3: Try to solve a problem in a particular period. This will prepare you for coding rounds before the interview
Tip 1: Never lie on your resume
Tip 2: You should have good projects on your resume
The online coding round consisted of three data structures and algorithms questions alongside ten multiple-choice questions, all scheduled to commence at 11 a.m., challenging my knowledge and skills.


Given an integer array arr of length n, the task is to find the maximum absolute difference between the nearest left smaller and nearest right smaller element of every element in array arr. If for any element in the arr, the nearest smaller element doesn't exist then consider it as 0.
Just implement using the concept of the next smaller element on the right and left of the array
and then iterate to the array and calculate the max abs diff


Given an integer array arr, find the contiguous subarray (containing at least one number) which has the largest sum and returns its sum.
The intuition of the algorithm is not to consider the subarray as a part of the answer if its sum is less than 0. A subarray with a sum less than 0 will always reduce our answer and so this type of subarray cannot be a part of the subarray with maximum sum.
Here, we will iterate the given array with a single loop and while iterating we will add the elements in a sum variable. Now, if at any point the sum becomes less than 0, we will set the sum as 0 as we are not going to consider any subarray with a negative sum. Among all the sums calculated, we will consider the maximum one.
In our group, which comprised five students, we were assigned the topic of essential skills for advancement in corporate life for our group discussion. This discussion was further segmented into three distinct sub-rounds. During the initial round, each student was provided with an opportunity to express their viewpoints. In the subsequent round, participants were encouraged to present innovative ideas related to the topic. Finally, in the third sub-round, students were given the chance to engage in a debate with their peers on the subject, despite it being structured as a group discussion.
It was a technical Interview along with some managerial questions. The time was 3 p.m..



Given an array consisting of only 0s, 1s, and 2s. Write a program to in-place sort the array without using inbuilt sort functions.
I first thought of counting the no. of 0s, 1s and 2s and then filling the array. This will take O(n) time complexity and constant space. However, the interviewer wanted me to solve this in a single pass that only iterate once.
So I used a 3 pointer approach
If arr[mid] == 0, we will swap arr[low] and arr[mid] and will increment both low and mid. Now the subarray from index 0 to (low-1) only contains 0.
If arr[mid] == 1, we will just increment the mid pointer and then the index (mid-1) will point to 1 as it should according to the rules.
If arr[mid] == 2, we will swap arr[mid] and arr[high] and will decrement high. Now the subarray from index high+1 to (n-1) only contains 2.
In this step, we will do nothing to the mid-pointer as even after swapping, the subarray from mid to high(after decrementing high) might be unsorted. So, we will check the value of mid again in the next iteration.

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