Tip 1: Solve the Striver A to Z DSA Sheet.
Tip 2: Revision is very important.
Tip 3: Don't take rejection from companies too seriously.
Tip 1: Keep it short and simple.
Tip 2: Add only what you know; don't include extra stuff.
Tip 3: Also, add projects that solve real-world problems.
The duration was 3 hours. The first section was for aptitude, and the second section consisted of 2 coding questions—one was medium, and the other was hard.
An array c is a subarray of array d if c can be obtained from d by deletion of several elements from the beginning and several elements from the end.
For e.g.- The non-empty subarrays of an array [1,2,3] will be- [1],[2],[3],[1,2],[2,3],[1,2,3].
If arr = {-3,4,5}.
All the possible non-empty contiguous subarrays of “arr” are {-3}, {4}, {5}, {-3,4}, {4,5} and {-3,4,5}.
The product of these subarrays are -3, 4, 5, -12, 20 and -60 respectively.
The maximum product is 20. Hence, the answer is 20.
Can you solve this in linear time and constant space complexity?
First Approach:
The idea is to traverse every contiguous subarray, find the product of each of these subarrays, and return the maximum product among all the subarrays.
Second Approach:
Create 3 variables: currMin, currMax, and maxProd, initialized to the first element of the array.
Iterate through the indices from 0 to N-1 and update the variables:
currMax = max(arr[i], currMax * arr[i], currMin * arr[i])
currMin = min(arr[i], currMax * arr[i], currMin * arr[i])
Update maxProd with the maximum value at each index.
Finally, return maxProd as the result.
Input: 'N' = 2, ‘MAT’ = [[1, 2], [5, 6]]
Output: 1 2 6 5
So the first row will be printed as it is and the second row will be printed in reverse order.
Traverse all rows.
For each row, check if it is even or odd.
If it is even, print from left to right; otherwise, print from right to left.
At 2 o’clock,
Good environment.
The interview was of medium difficulty. He asked me about pattern questions, swapping numbers without using a third variable, SQL queries, ACID properties, and all the functionalities of my project.
Write an SQL query to list the STUDENT_IDs who did not receive a scholarship. Also, include the join queries.
Tip 1: Practice SQL queries regularly.
Tip 2: Practice on any platform.
Bubble Sort implementation for the given array: {6,2,8,4,10} is shown below :-
Start: Begin with the first element.
Compare: Compare the current element with the next one.
Swap: If the current element is greater than the next, swap them.
Move Forward: Move to the next element and repeat the comparison and swapping.
End of Pass: After each full pass, the largest element is placed in its correct position.
Repeat: Continue the process for the remaining unsorted part of the list.
Done: Stop when no swaps are needed in a full pass.
Here's your problem of the day
Solving this problem will increase your chance to get selected in this company
Which SQL keyword removes duplicate records from a result set?