PayPal interview experience Real time questions & tips from candidates to crack your interview

Software Engineer

PayPal
upvote
share-icon
4 rounds | 7 Coding problems

Interview preparation journey

expand-icon
Preparation
Duration: 6 months
Topics: Data Structures, Algorithms, System Design, Aptitude, OOPS
Tip
Tip

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.:

Application process
Where: Campus
Eligibility: Above 7 CGPA
Resume Tip
Resume tip

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.

Interview rounds

01
Round
Medium
Online Coding Interview
Duration90 minutes
Interview date2 Dec 2016
Coding problem2

This was an online test for 90 minutes. 2 programming questions and MCQs related to CS fundamentals were asked.

1. Cycle Detection in a Singly Linked List

Moderate
15m average time
80% success
0/80
Asked in companies
Morgan StanleyDunzoOYO

You are given a Singly Linked List of integers. Return true if it has a cycle, else return false.


A cycle occurs when a node's next points back to a previous node in the list.


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

Sample Example 1

Problem approach

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; 
}

Try solving now

2. Palindrome Partitioning ll

Hard
40m average time
60% success
0/120
Asked in companies
PayPalAmazonAdobe

You are given a string 'str' of length 'n'.


Find the minimum number of partitions in the string so that no partition is empty and every partitioned substring is a palindrome.


Example :
Input: 'str' = "aaccb"

Output: 2

Explanation: We can make a valid partition like aa | cc | b. 
Problem approach

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).

Try solving now
02
Round
Medium
Face to Face
Duration60 minutes
Interview date2 Dec 2016
Coding problem2

Technical round that lasted for around 60 minutes. The interviewer asked questions related to data structures and algorithms.

1. DFS Traversal

Moderate
35m average time
65% success
0/80
Asked in companies
SamsungIntuitGoldman Sachs

Given an undirected and disconnected graph G(V, E), containing 'V' vertices and 'E' edges, the information about edges is given using 'GRAPH' matrix, where i-th edge is between GRAPH[i][0] and GRAPH[i][1]. print its DFS traversal.

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.
Note :
The Graph may not be connected i.e there may exist multiple components in a graph.
Problem approach

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)

Try solving now

2. Cycle Detection In Undirected Graph

Moderate
0/80
Asked in companies
AmazonAdobeSamsung

You have been given an undirected graph with 'N' vertices and 'M' edges. The vertices are labelled from 1 to 'N'.

Your task is to find if the graph contains a cycle or not.

A path that starts from a given vertex and ends at the same vertex traversing the edges only once is called a cycle.

Example :

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

Example

Note:

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.

For Example :

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. 
Problem approach

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;
}

Try solving now
03
Round
Medium
Face to Face
Duration60 minutes
Interview date2 Dec 2016
Coding problem3

Technical round that lasted for around 60 minutes. The interviewer asked questions related to data structures and algorithms.

1. Merge Sort

Easy
15m average time
85% success
0/40
Asked in companies
BarclaysOracleHCL Technologies

Given a sequence of numbers ‘ARR’. Your task is to return a sorted sequence of ‘ARR’ in non-descending order with help of the merge sort algorithm.

Example :

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.

subsequence

The above illustrates shows how merge sort works.
Note :
It is compulsory to use the ‘Merge Sort’ algorithm.
Problem approach

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)

Try solving now

2. Maximum Difference

Easy
15m average time
85% success
0/40
Asked in companies
PayPalOlaRaja Software Labs (RSL)

You are given an array 'ARR' of the 'N' element. Your task is to find the maximum difference between any of the two elements from 'ARR'.

If the maximum difference is even print “EVEN” without quotes. If the maximum difference is odd print “ODD” without quotes.

For example:

Given 'ARR' = [1, 10, 5, 2, 8, 1 ] , answer is "ODD".
Here the maximum difference is between 10 and 1, 10 - 1 = 9
Problem approach

Recursively call the function and find the maximum number of the submatrix and update the answer for every element of the matrix.

 

Algorithm:-

  1. Run a for loop from 0 to N-1  (Let’s say the iterator be i).
    1. Run a nested for loop from 0 to N-1 (Let’s say the iterator be j).
      1. Recursively find the answer of submatrix with top-left corner (i+1, j+1).
        1. If i+1== N or j+1== N return -infinity.
        2. Update answer as maximum of answer and maximum value in the submatrix with top-left corner (i,j)- MAT[i][j].
  2. Print the answer found.
Try solving now

3. Technical Question

What is hashing and how can it be implemented?

Problem approach

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

04
Round
Easy
HR Round
Duration30 minutes
Interview date2 Dec 2016
Coding problem0

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

Skill covered: Programming

How do you remove whitespace from the start of a string?

Choose another skill to practice
Similar interview experiences
company logo
Software Engineer
2 rounds | 3 problems
Interviewed by PayPal
3218 views
0 comments
0 upvotes
company logo
Software Engineer
3 rounds | 6 problems
Interviewed by PayPal
2470 views
0 comments
0 upvotes
company logo
Software Engineer
3 rounds | 5 problems
Interviewed by PayPal
3780 views
0 comments
0 upvotes
company logo
Software Engineer
3 rounds | 4 problems
Interviewed by PayPal
6480 views
0 comments
0 upvotes
Companies with similar interview experiences
company logo
Software Engineer
3 rounds | 7 problems
Interviewed by Optum
7976 views
1 comments
0 upvotes
company logo
Software Engineer
5 rounds | 5 problems
Interviewed by Microsoft
10148 views
1 comments
0 upvotes
company logo
Software Engineer
2 rounds | 4 problems
Interviewed by Amazon
4448 views
1 comments
0 upvotes