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

SDE - Intern

PayPal
upvote
share-icon
3 rounds | 9 Coding problems

Interview preparation journey

expand-icon
Preparation
Duration: 3 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
Easy
Face to Face
Duration60 minutes
Interview date15 Nov 2015
Coding problem4

Technical round that lasted for around 60 minutes. The interviewer asked me questions based on DSA and OOPS concepts.

1. Dijkstra's shortest path

Moderate
25m average time
65% success
0/80
Asked in companies
PayPalAmazonPhonePe

You have been given an undirected graph of ‘V’ vertices (labeled 0,1,..., V-1) and ‘E’ edges. Each edge connecting two nodes (‘X’,’Y’) will have a weight denoting the distance between node ‘X’ and node ‘Y’.

Your task is to find the shortest path distance from the source node, which is the node labeled as 0, to all vertices given in the graph.

Example:

Input:
4 5
0 1 5
0 2 8
1 2 9
1 3 2
2 3 6

alt text

In the given input, the number of vertices is 4, and the number of edges is 5.

In the input, following the number of vertices and edges, three numbers are given. The first number denotes node ‘X’, the second number denotes node ‘Y’ and the third number denotes the distance between node ‘X’ and ‘Y’.

As per the input, there is an edge between node 0 and node 1 and the distance between them is 5.

The vertices 0 and 2 have an edge between them and the distance between them is 8.
The vertices 1 and 2 have an edge between them and the distance between them is 9.
The vertices 1 and 3 have an edge between them and the distance between them is 2.
The vertices 2 and 3 have an edge between them and the distance between them is 6.

Note:

1. There are no self-loops(an edge connecting the vertex to itself) in the given graph.

2. There can be parallel edges i.e. two vertices can be directly connected by more than 1 edge.
Problem approach

Dijkstra's Algorithm basically starts at the source node and it analyzes the graph to find the shortest path between that node and all the other nodes in the graph.
The algorithm keeps track of the currently known shortest distance from each node to the source node and it updates these values if it finds a shorter path.
Once the shortest path between the source node and another node is found, that node is marked as "visited" and added to the path. 
The process continues until all the nodes in the graph have been added to the path. This way, we have a path that connects the source node to all other nodes following the shortest path possible to reach each node.
Pseudocode :

function Dijkstra(Graph, source):
2: for each vertex v in Graph: // Initialization
3: dist[v] := infinity // initial distance from source to vertex v is set to infinite
4: previous[v] := undefined // Previous node in optimal path from source
5: dist[source] := 0 // Distance from source to source
6: Q := the set of all nodes in Graph // all nodes in the graph are unoptimized - thus are in Q
7: while Q is not empty: // main loop
8: u := node in Q with smallest dist[ ]
9: remove u from Q
10: for each neighbor v of u: // where v has not yet been removed from Q.
11: alt := dist[u] + dist_between(u, v)
12: if alt < dist[v] // Relax (u,v)
13: dist[v] := alt
14: previous[v] := u
15: return previous[ ]

Try solving now

2. OOPS Question

Difference between C and C++

Problem approach

1. The C programming language is a procedural language type while C++ is an object-oriented programming language type.
2. C programming follows a top to down programming approach that focuses on the steps rather than the data. C++ follows a bottom-to-top approach that focuses on data rather than the overall procedure.
3. Since C is a structured programming language the program is divided into separate blocks known as functions. Since C++ is an object-oriented programming language, the code is divided into Objects and Classes.

3. OOPS Question

Difference between malloc and new

Problem approach

1. new calls constructor while malloc does not calls constructors 
2. new is an operator. malloc () is a function.
3. new returns exact data type while malloc() returns void *
4. On failure, new throws bad_alloc exception. While malloc() on failure, returns NULL.

4. OOPS Question

What is virtual function?

Problem approach

A C++ virtual function is a member function in the base class that you redefine in a derived class. It is declared using the virtual keyword. It is used to tell the compiler to perform dynamic linkage or late binding on the function. A 'virtual' is a keyword preceding the normal declaration of a function. When the function is made virtual, C++ determines which function is to be invoked at the runtime based on the type of the object pointed by the base class pointer.

02
Round
Easy
Face to Face
Duration60 minutes
Interview date15 Nov 2015
Coding problem3

Technical round that lasted for around 60 minutes. The interviewer asked me questions based on SQL and OOPS concepts.

1. DBMS Question

Query to find nth highest salary

Problem approach

TOP keyword can be used to find the nth highest salary. By default ORDER BY clause print rows in ascending order, since we need the highest salary at the top, we have used ORDER BY DESC, which will display salaries in descending order. Again DISTINCT is used to remove duplicates. The outer query will then pick the topmost salary, which would be your Nth highest salary.
SQL query : 

SELECT TOP 1 salary
FROM ( 
SELECT DISTINCT TOP N salary
FROM #Employee 
ORDER BY salary DESC 
) AS temp
ORDER BY salary

2. OOPS Question

OOPS contains 3 classes A,B,C and they are in multi level inheritance, was asked about the use of public, protected and private members of A in B and in C

Problem approach

When a subclass inherits a base class, it inherits only the members of superclass that are marked with public, protected visibility modes, these members are -
Properties of the base class.
Functions of the base class.
Note - Base class members marked with private visibility mode are never inherited.

3. OOPS Question

Difference between Stack and Heap

Problem approach

1. Stack is a linear data structure whereas Heap is a hierarchical data structure.
2. Stack memory will never become fragmented whereas Heap memory can become fragmented as blocks of memory are first allocated and then freed.
3.Stack memory is allocated in a contiguous block whereas Heap memory is allocated in any random order.
4. Stack variables can’t be resized whereas Heap variables can be resized.

03
Round
Easy
HR Round
Duration30 minutes
Interview date15 Nov 2015
Coding problem2

HR round that lasted for around 30 minutes. The interviewer asked questions to know more about me. We also discussed a puzzle.

1. Puzzle

Hourglasses Puzzle

Problem approach

1. At 0 minutes: Start both hourglasses at the same time.
2. At 4 minutes: 4 minutes hourglass runs out and flip it. 7 minutes hourglass is left with 3 minutes.
3. At 7 minutes: 4 minutes hourglass is left with 1 minute. 7 minutes hourglass runs out and flip it.
4.At 8 minutes: 4 minutes hourglass runs out and 7 is filled with 6 minutes and 1 minute on the other side. Flip it as the sand is left with 1 minute.
5. At 9 minutes: 7 minutes hourglass becomes empty from above side.

2. Basic HR Question

Q1. Firstly was asked about the subjects I'm studying this semester
Q2. Different questions about my projects
 

Problem approach

Tip 1 : The cross questioning can go intense some time, think before you speak.
Tip 2 : Be open minded and answer whatever you are thinking, in these rounds I feel it is important to have opinion.
Tip 3 : Context of questions can be switched, pay attention to the details. It is okay to ask questions in these round, like what are the projects currently the company is investing, which team you are mentoring. How all is the work environment etc.

Here's your problem of the day

Solving this problem will increase your chance to get selected in this company

Skill covered: Programming

What is recursion?

Choose another skill to practice
Similar interview experiences
company logo
SDE - Intern
3 rounds | 4 problems
Interviewed by PayPal
1484 views
0 comments
0 upvotes
company logo
SDE - Intern
3 rounds | 4 problems
Interviewed by PayPal
0 views
0 comments
0 upvotes
company logo
SDE - Intern
2 rounds | 4 problems
Interviewed by PayPal
4949 views
0 comments
0 upvotes
company logo
SDE - 2
2 rounds | 4 problems
Interviewed by PayPal
971 views
0 comments
0 upvotes
Companies with similar interview experiences
company logo
SDE - Intern
3 rounds | 6 problems
Interviewed by Amazon
15480 views
4 comments
0 upvotes
company logo
SDE - Intern
4 rounds | 7 problems
Interviewed by Microsoft
15338 views
1 comments
0 upvotes
company logo
SDE - Intern
2 rounds | 4 problems
Interviewed by Amazon
10142 views
2 comments
0 upvotes