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 coding round where we had 2 questions of Medium to Hard level of difficulty to solve under 90 minutes. I was able to solve the 2nd question fully and the 1st one partially. 10 students were shortlisted for further rounds and I was one of them.



str = "ababc"
The longest palindromic substring of "ababc" is "aba", since "aba" is a palindrome and it is the longest substring of length 3 which is a palindrome.
There is another palindromic substring of length 3 is "bab". Since starting index of "aba" is less than "bab", so "aba" is the answer.
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 and
initilialise a variable ans=1 which will store the final answer.
2) Base Case : For every i from 0 to n-1 fill dp[i][i]=1 ( as a single character is always a palindrome ) .
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 update the answer
as ans=max(ans , j-i+1).
6) Finally return the ans
TC : O(N^2) where N=length of the string s
SC : O(N^2)



An array ‘B’ is a subarray of an array ‘A’ if ‘B’ that can be obtained by deletion of, several elements(possibly none) from the start of ‘A’ and several elements(possibly none) from the end of ‘A’.
Approach (Using Hashing) :
1) Create a HashMap “prefXor” which stores the count of subarrays having a particular XOR value.
2) Create a variable “curXor” which stores the XOR for ‘i’ elements. Initialise it with zero. Also, create a
variable called “ans” to store the count of the subarrays having XOR ‘X’.
3) Start iterating through given array/list using a variable ‘i’ such that 0 <= ‘i’ < n
3.1) Update the “curXor” i.e. curXor = curXor ^ arr[i]
3.2) Store the required value of the prefix Xor to make the XOR of the subarray ending at the current
index equal to X i.e. req = X ^ curXor
3.3) Now add the count of prefix arrays with required xor i.e. ans = ans + prefXor[req]
3.4) Update the “prefXor” HashMap with the “curXor” i.e. prefXor[curXor] = prefXor[curXor] + 1
TC : O(N), where N=size of the array
SC : O(N)
This was a preety intense round where I had to solve 3 algorithmic questions under 70 minutes. I first explained my approach for each of these questions and also discussed why they were optimal in the first place with their respective time and space compleixities. The interviewer was quite impressed at the end of the round.



1. add(DATA) :
This function should take one argument of type and store it in its pool and returns the 'kth' largest number from the current pool of integers.
val - For this query, insert the integer into your current pool of integers and return the 'kth' largest integer from the existing pool of integers.
1. The maximum number of integers that will be given will always be under memory limits.
2. You will also be given an initial pool of integers whose size equals k.
3. The maximum number of queries will be less than 10^5.
4. The 'kth' largest element is not the 'kth' distinct element but the 'kth' largest element in the sorted order.
5. There will be at least one query of type 2.
Naive Solution:
Keep an array of size k. The idea is to keep the array sorted increasing order so that the k'th largest element can be
found in O(1) time.
How to process a new element of stream?
For every new element in stream, check if the new element is smaller than current k'th largest element. If yes, then
ignore it. If no, then remove the smallest element from array and insert new element in sorted order. Time complexity
of processing a new element becomes O(k).
Efficient Solution:
Use Min Heap of size k to store k largest elements of stream. Thr k'th largest element is always at root and can be
found in O(1) time.
How to process a new element of stream?
Compare the new element with root of heap. If new element is smaller, then ignore it. Otherwise replace root with
new element and call heapify for the root of modified heap.



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)



1. Constructor:
It initializes the data members(queues) as required.
2. push(data) :
This function should take one argument of type integer. It pushes the element into the stack and returns nothing.
3. pop() :
It pops the element from the top of the stack and, in turn, returns the element being popped or deleted. In case the stack is empty, it returns -1.
4. top :
It returns the element being kept at the top of the stack. In case the stack is empty, it returns -1.
5. size() :
It returns the size of the stack at any given instance of time.
6. isEmpty() :
It returns a boolean value indicating whether the stack is empty or not.
Query-1(Denoted by an integer 1): Pushes an integer data to the stack. (push function)
Query-2(Denoted by an integer 2): Pops the data kept at the top of the stack and returns it to the caller. (pop function)
Query-3(Denoted by an integer 3): Fetches and returns the data being kept at the top of the stack but doesn't remove it, unlike the pop function. (top function)
Query-4(Denoted by an integer 4): Returns the current size of the stack. (size function)
Query-5(Denoted by an integer 5): Returns a boolean value denoting whether the stack is empty or not. (isEmpty function)
Operations:
1 5
1 10
2
3
4
Enqueue operation 1 5: We insert 5 at the back of the queue.
Queue: [5]
Enqueue operation 1 10: We insert 10 at the back of the queue.
Queue: [5, 10]
Dequeue operation 2: We remove the element from the front of the queue, which is 5, and print it.
Output: 5
Queue: [10]
Peek operation 3: We return the element present at the front of the queue, which is 10, without removing it.
Output: 10
Queue: [10]
IsEmpty operation 4: We check if the queue is empty.
Output: False
Queue: [10]
Approach : A stack can be implemented using two queues. Let stack to be implemented be ‘s’ and queues used to
implement be ‘q1’ and ‘q2’. Stack ‘s’ can be implemented in two ways :
Method 1 (push - O(1) , pop - O(n) ) :
1) push(s, x) operation :
i) Enqueue x to q1 (assuming size of q1 is unlimited).
2) pop(s) operation :
i) One by one dequeue everything except the last element from q1 and enqueue to q2.
ii) Dequeue the last item of q1, the dequeued item is result, store it.
iii) Swap the names of q1 and q2
iv) Return the item stored in step 2.
TC : push(s,x) -> O(1)
pop() -> O(n)
Method 2 (push - O(n) , pop - O(1) ) :
1) push(s, x) operation :
i) Enqueue x to q2
ii) One by one dequeue everything from q1 and enqueue to q2.
iii) Swap the names of q1 and q2
2) pop(s) operation :
i) Dequeue an item from q1 and return it.
TC : push(s,x) -> O(n)
pop() -> O(1)
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
Do you know anything about the company ?
General Tip : Before an interview for any company , have a breif insight about the company , what it does , when was
it founded and so on . All these info can be easily acquired from the Company Website itself.

Here's your problem of the day
Solving this problem will increase your chance to get selected in this company
To make an AI less repetitive in a long paragraph, you should increase: