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 test for 90 minutes. 2 programming questions and MCQs related to CS fundamentals were asked.



In the given linked list, there is a cycle, hence we return true.

Floyd's algorithm can be used to solve this question.
Define two pointers slow and fast. Both point to the head node, fast is twice as fast as slow. There will be no cycle if it reaches the end. Otherwise, it will eventually catch up to the slow pointer somewhere in the cycle.
Let X be the distance from the first node to the node where the cycle begins, and let X+Y be the distance the slow pointer travels. To catch up, the fast pointer must travel 2X + 2Y. L is the cycle size. The total distance that the fast pointer has travelled over the slow pointer at the meeting point is what we call the full cycle.
X+Y+L = 2X+2Y
L=X+Y
Based on our calculation, slow pointer had already traveled one full cycle when it met fast pointer, and since it had originally travelled A before the cycle began, it had to travel A to reach the cycle's beginning!
After the two pointers meet, fast pointer can be made to point to head. And both slow and fast pointers are moved till they meet at a node. The node at which both the pointers meet is the beginning of the loop.
Pseudocode :
detectCycle(Node *head) {
Node *slow=head,*fast=head;
while(slow!=NULL && fast!=NULL && fast->next!=NULL) {
slow = slow->next;
fast = fast->next->next;
if(slow==fast)
{
fast = head;
while(slow!=fast)
{
slow = slow->next;
fast=fast->next;
}
return slow;
}
}
return NULL;
}



Input: 'str' = "aaccb"
Output: 2
Explanation: We can make a valid partition like aa | cc | b.
The problem can be solved using recursion. If the given string is a palindrome, 0 cuts are needed. Otherwise, try making cuts at all possible positions and calculate the cost for each cut recursively and take the minimum of all costs.
// i is the starting index and j is the ending index. Initially, i=0 and j=n-1
minCuts(str, i, j) = 0 if i == j // When string is of length 1.
minCuts(str, i, j) = 0 if str[i..j] is palindrome.
// If the above conditions are not true, then minimum cuts needed can be calculated recursively using the following formula.
minCuts(str, i, j) = min { minCuts(str, i, k) + 1 + minCuts(str, k+1, j) } where k varies from i to j-1
The above approach can be optimized using dynamic programming. A 2-d array can be used to store the intermittent results calculated in recursive functions. The time complexity of this approach would be O(N^3).
Technical round that lasted for around 60 minutes. The interviewer asked questions related to data structures and algorithms.



V is the number of vertices present in graph G and vertices are numbered from 0 to V-1.
E is the number of edges present in graph G.
The Graph may not be connected i.e there may exist multiple components in a graph.
The DFS algorithm is a recursive algorithm based on the idea of backtracking. It starts with the initial node of the graph G, and then goes to deeper and deeper until we find the goal node or the node which has no children.
Pseudocode :
DFS(G, s):
mark s as visited
for all neighbors v of s in Graph G:
if v is not visited:
DFS-recursive(G, v)



In the below graph, there exists a cycle between vertex 1, 2 and 3.

1. There are no parallel edges between two vertices.
2. There are no self-loops(an edge connecting the vertex to itself) in the graph.
3. The graph can be disconnected.
Input: N = 3 , Edges = [[1, 2], [2, 3], [1, 3]].
Output: Yes
Explanation : There are a total of 3 vertices in the graph. There is an edge between vertex 1 and 2, vertex 2 and 3 and vertex 1 and 3. So, there exists a cycle in the graph.
DFS can be used to detect cycle in an undirected graph. Do a DFS traversal of the given graph. For every visited vertex ‘v’, if there is an adjacent ‘u’ such that u is already visited and u is not parent of v, then there is a cycle in graph.
If we don’t find such an adjacent for any vertex, we say that there is no cycle.
Pseudocode :
DetectCycle(graph, v, visited[], parent)
{
// mark the current node as visited
visited[v] = true;
// do for every edge (v, w)
for (w: graph[v])
{
// if `w` is not visited yet
if (!visited[w])
{
if (DetectCycle(graph, w, visited, v)) {
return true;
}
}
// if `w` is visited, and `w` is not a parent
else if (w != parent)
{
// back-edge (cycle) found
return true;
}
}
// No back-edges were found in the graph
return false;
}
Technical round that lasted for around 60 minutes. The interviewer asked questions related to data structures and algorithms.



Merge Sort Algorithm -
Merge sort is a Divide and Conquer based Algorithm. It divides the input array into two-parts, until the size of the input array is not ‘1’. In the return part, it will merge two sorted arrays a return a whole merged sorted array.

The above illustrates shows how merge sort works.
It is compulsory to use the ‘Merge Sort’ algorithm.
It works on the principle of Divide and Conquer. Merge sort repeatedly divides the array into several arrays until each array consists of a single element and merging those arrays in a manner that results into a sorted array.
Pseudocode :
MergeSort(A, p, r):
if p > r
return
q = (p+r)/2
mergeSort(A, p, q)
mergeSort(A, q+1, r)
merge(A, p, q, r)
Merge function : The task is to merge two subarrays A[p..q] and A[q+1..r] to create a sorted array A[p..r].
Steps :
Create copies of the subarrays L ← A[p..q] and M ← A[q+1..r].
Create three pointers i, j and k
i indicates current index of L, starting at 1
j indicates current index of M, starting at 1
k indicates the current index of A[p..q], starting at p.
Until we reach the end of either L or M, pick the larger among the elements from L and M and place them in the correct position at A[p..q]
When we run out of elements in either L or M, pick up the remaining elements and put in A[p..q]
Time complexity : O(nlogn)



Given 'ARR' = [1, 10, 5, 2, 8, 1 ] , answer is "ODD".
Here the maximum difference is between 10 and 1, 10 - 1 = 9
Recursively call the function and find the maximum number of the submatrix and update the answer for every element of the matrix.
Algorithm:-
What is hashing and how can it be implemented?
Hashing is a technique of mapping keys, values into the hash table by using a hash function. It is done for faster access to elements.
Hashing is implemented in two steps:
An element is converted into an integer by using a hash function. This element is used as an index to store the original element, which falls into the hash table.
The element is stored in the hash table where it can be quickly retrieved using hashed key.
hash = hashfunc(key)
index = hash % array_size
1. Questions related to to resume
2. Why do you want to join in PayPal?
3. Explain anything whatever you learned recently?

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?