Tip 1: Practice 150+ questions from different coding platforms.
Tip 2: Build projects.
Tip 1: Make it simple and clear.
Tip 2: Specify projects and skills if you don't have a job.
This round is the online test consisting of (Aptitude and Technical Questions)
Hiren allocated 45% of his monthly pay to paying bills and rent in March. He then invested 60% of his extra cash into the PPF scheme and kept the remaining 20%. He deposited $15,400 into his bank account. If his salary increased by 10% in April, what was it?
Ans: 77000
What kind of structure enables both deleting data items and adding them at the back?
a) Stack.
b) Queue.
c) Binary Search Tree.
d) Dequeue.
Ans:- Stack
From the given options. Find the operating system that is not a real-time operating system.
a) VX Works.
b) RT Linux.
c) Palm OS.
d) Windows CE.
Answer: c) Palm DS
This round is an online coding test consisting of 3 DSA questions



Find the length of the longest natural sorted subsequence already present in the given string.
Initialize Variables:
max_length to store the length of the longest natural sorted subsequence (initialize to 0).
current_length to store the current length of the subsequence being checked (initialize to 1).
prev_char to store the previous character in the subsequence (initialize to the first character of the string).
Iterate Through the String:
Start iterating from the second character of the string.
For each character char in the string:
If char is greater than prev_char, increment current_length by 1.
If char is not greater than prev_char, reset current_length to 1.
Update max_length if current_length is greater than max_length.
Update prev_char to char.
Return max_length.


Given n non-negative integers representing an elevation map where the width of each bar is 1, compute how much water it can trap after raining.
Initialize an array ans[] to store the maximum height of bars to the right of each bar.
Traverse the elevation map from right to left and update ans[] with the maximum height encountered so far.
Initialize a variable max to track the maximum height encountered while traversing from left to right.
Traverse the elevation map from left to right.
For each bar, calculate the amount of water that can be trapped above it by taking the minimum of the maximum height of bars to its left and right (stored in ans[] and max, respectively), and subtracting the height of the current bar.
Add up the amount of water trapped above each bar to get the total amount of trapped rainwater.
Return the total amount of trapped rainwater.



Given an array nums of distinct integers, return all the possible permutations. You can return the answer in any order.
class Solution {
public int trap(int[] height) {
int n = height.length;
int ans[] = new int[n];
int max = 0;
for(int i=n-1;i>=0;i--)
{
if(max ans[i] = max;
}
max = 0;
int sol = 0;
for(int i=0;i { if(max sol+= Math.min(max,ans[i])-height[i];
}
return sol
;
}
}
The interviewer asked me to explain each of my code and asked me some DSA problems



You are given an array of 0s and 1s in random order. Segregate 0s on left side and 1s on right side of the array [Basically you have to sort the array]. Traverse array only once.
1) Count the number of 0s. So let’s understand with an example we have an array arr = [0, 1, 0, 1, 0, 0, 1] the size of the array is 7 now we will traverse the entire array and find out the number of zeros in the array, In this case the number of zeros is 4 so now we can easily get the number of Ones in the array by Array Length – Number Of Zeros.
2) Once we have counted, we can fill the array first we will put the zeros and then ones (we can get number of ones by using above formula).



Write a code for merge Sort.
1. Divide: Divide the list or array recursively into two halves until it can no more be divided.
2. Conquer: Each subarray is sorted individually using the merge sort algorithm.
3. Merge: The sorted subarrays are merged back together in sorted order. The process continues until all elements from both subarrays have been merged.

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