Tip 1 : Must do Previously asked Interview as well as Online Test Questions.
Tip 2 : Go through all the previous interview experiences from Codestudio and Leetcode.
Tip 3 : Do at-least 2 good projects and you must know every bit of them.
Tip 1 : Have at-least 2 good projects explained in short with all important points covered.
Tip 2 : Every skill must be mentioned.
Tip 3 : Focus on skills, projects and experiences more.
This was an online proctured coding test where we had 2 questions to solve under 60 minutes. The questions were of Easy to Medium level.



Infix notation is a method of writing mathematical expressions in which operators are placed between operands.
For example, "3 + 4" represents the addition of 3 and 4.
Postfix notation is a method of writing mathematical expressions in which operators are placed after the operands.
For example, "3 4 +" represents the addition of 3 and 4.
Expression contains digits, lower case English letters, ‘(’, ‘)’, ‘+’, ‘-’, ‘*’, ‘/’, ‘^’.
Input: exp = ‘3+4*8’
Output: 348*+
Explanation:
Here multiplication is performed first and then the addition operation. Hence postfix expression is 3 4 8 * +.
Approach :
1) Scan the infix expression from left to right.
2) If the scanned character is an operand, output it.
3) Else,
3.1) If the precedence of the scanned operator is greater than the precedence of the operator in the stack(or the stack is empty or the stack contains a ‘(‘ ), push it.
3.2) Else, Pop all the operators from the stack which are greater than or equal to in precedence than that of the scanned operator. After doing that Push the scanned operator to the stack. (If you encounter parenthesis while popping then stop there and push the scanned operator in the stack.)
4) If the scanned character is an ‘(‘, push it to the stack.
5) If the scanned character is an ‘)’, pop the stack and output it until a ‘(‘ is encountered, and discard both the parenthesis.
6) Repeat steps 2-6 until infix expression is scanned.
7) Print the output
8) Pop and output from the stack until it is not empty.
TC : O(N) where N=length of the expression
SC : O(N)



If the given array is: [0, 0, 1, 0, 1] The largest subarray would be: [0, 1, 0, 1] (last 4 elements) having length 4.
Approach :
1) Consider 0 as -1 and 1 as 1 since the sum for equal numbers of 0s and 1s would be 0.
2) Store the cumulative sums in a hashmap. There can be two cases:
2.1) When cumulative sum is 0: This means that the subarray from index 0 to the present index has equal number of 0s and 1s
2.2) When cumulative sum is not equal to 0: This means that the subarray from the index which had this sum before to the present index has equal number of 0s and 1s
3) Note that you only need to store the first occurrence of each sum, since we need to find the largest subarray.
TC : O(N), where N=size of the array
SC : O(N)
In this round, the interviewer asked me 2 questions related to DSA and then some questions from OS were asked to check basic understanding of the subject.



Consider ‘S’ = ‘abba’, all the possible substrings are [ ‘a’, ‘ab’, ‘abb’, 'abba', 'b', ‘ba’, 'bb', ‘bba’ ] out of which [ ‘a’, ‘abba’, 'b’, 'bb'] are palindromic substrings.
I solved it using DP as I was able to figure out what my dp table would store and the dp transition state .
Approach :
1) Create a 2-D dp boolean vector(with all false initially) where dp[i][j] states whether s[i...j] is a palindrome or not .
2) Base Case : For every i from 0 to n-1 fill dp[i][i]=1 ( as a single character is always a palindrome )and increment the counter where counter=0 initially
3) Now, run 2 loops first one from i=n-1 to i=0 (i.e., tarverse from the back of the string) and the second one from j=i+1 to n .
4) For every s[i]==s[j] , check if(j-i==1 i.e., if s[i] and s[ j] are two consecutive same letters) or if(dp[i+1][j-1]==1 or not i.e., if the string s[i+1,....j-1] is palindrome or not .
5) Because if the string s[i+1,....j-1] is a palindrome and s[i]==s[j] then s[i] and s[j] can be appended at the starting and the ending position of s[i+1,...j-1] and s[i...j] will then be a palindrome , so mark dp[i][j]=1 and increment the counter
6) Finally return the counter
TC : O(N^2) where N=length of the string s
SC : O(N^2)



You may assume that given ‘X’ and ‘Y’ definitely exist in the given binary tree.
For the given binary tree

LCA of ‘X’ and ‘Y’ is highlighted in yellow colour.
Approach :
1) Start traversing the tree from the root node.
2) If the current node itself is one of p or q, we would mark a variable mid as True and continue the search for the other node in the left and right branches.
3) If either of the left or the right branch returns True, this means one of the two nodes was found below.
4) If at any point in the traversal, any two of the three flags left, right or mid become True, this means we have found the lowest common ancestor for the nodes p and q.
TC : O(N), where N=number of nodes in the binary tree
SC : O(N)
What are the differences b/w Mutex and Semaphore?
Semaphore : Semaphore is simply a variable that is non-negative and shared between threads. A semaphore is a signaling mechanism, and a thread that is waiting on a semaphore can be signaled by another thread. It uses two atomic operations, 1)wait, and 2) signal for the process synchronization.
A semaphore either allows or disallows access to the resource, which depends on how it is set up.
Mutex : The full form of Mutex is Mutual Exclusion Object. It is a special type of binary semaphore which used for controlling access to the shared resource. It includes a priority inheritance mechanism to avoid extended priority inversion problems. It allows current higher priority tasks to be kept in the blocked state for the shortest time possible. However, priority inheritance does not correct priority- inversion but only minimizes its effect.
Main points of difference b/w Mutex and Semaphore :
1) Mutex is a locking mechanism whereas Semaphore is a signaling mechanism
2) Mutex is just an object while Semaphore is an integer
3) Mutex has no subtype whereas Semaphore has two types, which are counting semaphore and binary semaphore.
4) Semaphore supports wait and signal operations modification, whereas Mutex is only modified by the process that may request or release a resource.
5) Semaphore value is modified using wait () and signal () operations, on the other hand, Mutex operations are locked or unlocked.
Explain multitasking and multiprogramming.
Multitasking :
1) In Multitasking, a single resource is used to process multiple tasks.
2) The process resides in the same CPU.
3 It is time sharing as the task assigned switches regularly.
4) Multitasking follows the concept of context switching.
Multiprogramming :
1) In multiprogramming, multiple programs execute at a same time on a single device.
2) The process resides in the main memory.
3) It uses batch OS. The CPU is utilized completely while execution.
4) The processing is slower, as a single job resides in the main memory while execution.
This round had 2 questions from DSA which were followed by some core concepts from OOPS and Java.



The given linked lists may or may not be null.
If the first list is: 1 -> 4 -> 5 -> NULL and the second list is: 2 -> 3 -> 5 -> NULL
The final list would be: 1 -> 2 -> 3 -> 4 -> 5 -> 5 -> NULL
Approach :
1) Compare the head of both linked lists.
2) Find the smaller node among the two head nodes. The current element will be the smaller node among two head nodes.
3) The rest elements of both lists will appear after that.
4) Now run a recursive function with parameters, the next node of the smaller element, and the other head.
5) The recursive function will return the next smaller element linked with rest of the sorted element. Now point the next of current element to that, i.e curr_ele->next=recursivefunction()
6) Handle some corner cases.
6.1) If both the heads are NULL return null.
6.2) If one head is null return the other.
TC : O(N), where N=number of nodes in the Linked List
SC : O(N)



Heaps can be used in sorting an array. In max-heaps, maximum element will always be at the root. Heap Sort uses this property of heap to sort the array.
Algorithm :
1) Initially build a max heap of elements in ARR.
2) The root element, that is ARR[1], will contain maximum element of ARR. After that, swap this element with the last element of and heapify the max heap excluding the last element of ARR which is already in its correct position.
3) Decrease the length of heap by one.
4) Repeat the step 2 and 3, until all the elements are in their correct position.
TC : O(N*log(N))
SC : O(1)
//Pseudo Code :
void max_heapify (int Arr[ ], int i, int N)
{
int left = 2*i //left child
int right = 2*i +1 //right child
if(left<= N and Arr[left] > Arr[i] )
largest = left;
else
largest = i;
if(right <= N and Arr[right] > Arr[largest] )
largest = right;
if(largest != i )
{
swap (Ar[i] , Arr[largest]);
max_heapify (Arr, largest,N);
}
}
void build_maxheap (int Arr[ ])
{
for(int i = N/2 ; i >= 1 ; i-- )
{
max_heapify (Arr, i) ;
}
}
void heap_sort(int Arr[ ])
{
int heap_size = N;
build_maxheap(Arr);
for(int i = N; i >= 2 ; i-- )
{
swap|(Arr[ 1 ], Arr[ i ]);
heap_size = heap_size - 1;
max_heapify(Arr, 1, heap_size);
}
}
What is the difference b/w Abstract Class and Interface in Java?
Abstract class and interface both are used to achieve abstraction where we can declare the abstract methods.
Key differences b/w Abstract Class and Interface are :
1) Abstract class can have abstract and non-abstract methods.
Interface can have only abstract methods. Since Java 8, it can have default and static methods also.
2) Abstract class doesn't support multiple inheritance.
Interface supports multiple inheritance.
3) Abstract class can have final, non-final, static and non-static variables.
Interface has only static and final variables.
4) Abstract class can provide the implementation of interface.
Interface can't provide the implementation of abstract class.
5) The abstract keyword is used to declare abstract class.
The interface keyword is used to declare interface.
6) An abstract class can extend another Java class and implement multiple Java interfaces.
An interface can extend another Java interface only.
7) An abstract class can be extended using keyword "extends".
An interface can be implemented using keyword "implements".
Explain Method Overloading and Method Overriding.
Method Overloading :
1) Method overloading is a compile time polymorphism.
2) It is occur within the class.
3) Method overloading may or may not require inheritance.
4) In this, methods must have same name and different signature.
5) In method overloading, return type can or can not be be same, but we must have to change the parameter.
Method Overriding :
1) Method overriding is a run time polymorphism.
2) It is performed in two classes with inheritance relationship.
3) Method overriding always needs inheritance.
4) In this, methods must have same name and same signature.
5) In this, return type must be same or co-variant.
This was a typical HR round with some standard Behavioral questions.
Tell me something about yourself?
Tip 1 : Prepare the points that you will speak in your introduction prior to the interview.
Tip 2 : Tell about your current cgpa, achievements and authenticated certification
Tip 3 : I told about my role in current internship and what all I do
Why you want to be a part of Oracle?
Tip 1 : Oracle technologies are modern, cutting edge and built for enterprise requirements (think world class security, availability, performance, scalability, integrated ML/AI and so forth). Oracle Database is #1 worldwide.
Tip 2 : Since it’s inception, Oracle has become a market leader when it comes to database. Oracle has its own all possible solution for it’s clients whether it is into IT or Banking.
Tip 3 : Oracle gives your job sustainability with better career growth - in terms of job profile and package both.

Here's your problem of the day
Solving this problem will increase your chance to get selected in this company
How do you remove whitespace from the start of a string?