Add office photos
PayPal logo
Employer?
Claim Account for FREE

PayPal

3.9
based on 921 Reviews
Video summary
Filter interviews by
Software Engineer
Fresher
Skills
Clear (1)

40+ PayPal Software Engineer Interview Questions and Answers

Updated 3 Jul 2024

Q1. Cycle Detection in a Singly Linked List

Determine if a given singly linked list of integers forms a cycle or not.

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

Ans.

Detect if a singly linked list forms a cycle by checking if a node's next points back to a previous node.

  • Traverse the linked list using two pointers, one moving one step at a time and the other moving two steps at a time.

  • If the two pointers meet at any point, it indicates the presence of a cycle in the linked list.

  • If one of the pointers reaches the end of the list (null), it means there is no cycle.

Add your answer
right arrow

Q2. Painting Fences Problem Statement

You are given ‘N’ fences. Your task is to compute the total number of ways to paint these fences using only 2 colors, such that no more than 2 adjacent fences have the same col...read more

Ans.

The task is to compute the total number of ways to paint 'N' fences using 2 colors, such that no more than 2 adjacent fences have the same color.

  • Use dynamic programming to solve the problem efficiently.

  • Consider two cases: when the last two fences have the same color and when they have different colors.

  • Implement a solution that calculates the number of ways to paint 'N' fences modulo 10^9 + 7.

  • For N = 2, there are 4 valid ways to paint the fences: [0, 1], [1, 0], [1, 1], and [0...read more

Add your answer
right arrow
PayPal Software Engineer Interview Questions and Answers for Freshers
illustration image

Q3. Cycle Detection in Undirected Graph Problem Statement

You are provided with an undirected graph containing 'N' vertices and 'M' edges. The vertices are numbered from 1 to 'N'. Your objective is to determine whe...read more

Ans.

Detect cycles in an undirected graph with given vertices and edges.

  • Use Depth First Search (DFS) to traverse the graph and detect cycles.

  • Maintain a visited array to keep track of visited vertices and a parent array to keep track of the parent of each vertex.

  • If while traversing, you encounter a visited vertex that is not the parent of the current vertex, then a cycle exists.

  • Consider edge cases like disconnected graphs and self-loops.

Add your answer
right arrow

Q4. Reverse Linked List Problem Statement

Given a singly linked list of integers, return the head of the reversed linked list.

Example:

Initial linked list: 1 -> 2 -> 3 -> 4 -> NULL
Reversed linked list: 4 -> 3 -> 2...read more
Ans.

Reverse a singly linked list of integers and return the head of the reversed linked list.

  • Iterate through the linked list and reverse the pointers to point to the previous node instead of the next node.

  • Keep track of the previous, current, and next nodes while reversing the linked list.

  • Update the head of the reversed linked list as the last node encountered during reversal.

Add your answer
right arrow
Discover PayPal interview dos and don'ts from real experiences

Q5. Cycle Detection in a Directed Graph

Determine if a given directed graph contains a cycle. Return true if at least one cycle is found, otherwise return false.

Input:

T
The first line consists of the integer T, re...read more
Ans.

Detect if a directed graph contains a cycle.

  • Use depth-first search (DFS) to detect cycles in the graph.

  • Maintain a visited array to keep track of visited vertices.

  • If a vertex is visited again during DFS and it is not the parent of the current vertex, then a cycle exists.

  • Return true if a cycle is found, false otherwise.

Add your answer
right arrow

Q6. Integer to Roman Conversion

Given an integer N, convert it to its corresponding Roman numeral representation. Roman numerals comprise seven symbols: I, V, X, L, C, D, and M.

Example:

Input:
N = 2
Output:
II
Exp...read more
Ans.

Convert an integer to its corresponding Roman numeral representation.

  • Create a mapping of integer values to Roman numeral symbols

  • Iterate through the mapping in descending order of values and build the Roman numeral representation

  • Handle special cases like 4, 9, 40, 90, 400, 900 separately

  • Repeat the process for each digit of the input integer

Add your answer
right arrow
Are these interview questions helpful?

Q7. Find All Pairs Adding Up to Target

Given an array of integers ARR of length N and an integer Target, your task is to return all pairs of elements such that they add up to the Target.

Input:

The first line conta...read more
Ans.

The task is to find all pairs of elements in an array that add up to a given target.

  • Iterate through the array and for each element, check if the difference between the target and the element exists in a hash set.

  • If it exists, add the pair to the result. If not, add the element to the hash set.

  • Handle cases where the same element is used twice in a pair.

  • Return (-1, -1) if no pair is found.

Add your answer
right arrow

Q8. Merge Sort Problem Statement

You are given a sequence of numbers, ARR. Your task is to return a sorted sequence of ARR in non-descending order using the Merge Sort algorithm.

Explanation:

The Merge Sort algorit...read more

Ans.

Implement Merge Sort algorithm to sort a sequence of numbers in non-descending order.

  • Implement the Merge Sort algorithm using a Divide and Conquer approach

  • Recursively divide the input array into two halves until the size of each array is 1

  • Merge the sorted halves to produce a completely sorted array

  • Ensure the output is in non-descending order

Add your answer
right arrow
Share interview questions and help millions of jobseekers 🌟
man with laptop

Q9. Design a Constant Time Data Structure

Create a data structure that maintains mappings between keys and values, supporting the following operations in constant time:

1. INSERT(key, value): Add or update the inte...read more
Ans.

Design a constant time data structure for key-value mappings with operations like INSERT, DELETE, SEARCH, GET, GET_SIZE, and IS_EMPTY.

  • Use a hash table to store key-value pairs for constant time operations.

  • Implement INSERT by hashing the key and storing the value at the corresponding index.

  • For DELETE, simply remove the key-value pair from the hash table.

  • SEARCH can be done by checking if the key exists in the hash table.

  • GET retrieves the value associated with the key, returning...read more

Add your answer
right arrow

Q10. Painter's Partition Problem

You are given an array/list of length 'N'. Each element of the array/list represents the length of a board. There are 'K' painters available to paint these boards. Each unit of a boa...read more

Ans.

Find the minimum time required for 'K' painters to paint 'N' boards with given lengths.

  • Use binary search to find the minimum and maximum possible time to paint all boards.

  • Iterate through the possible time range and check if it is feasible to paint all boards within that time.

  • Keep track of the number of painters used and update the time range accordingly.

Add your answer
right arrow

Q11. Total Area of Overlapping Rectangles Problem Statement

Determine the total area covered by two given rectangles on a 2-D coordinate plane, which may have an overlapping area.

Input:

The first line contains an i...read more
Ans.

Calculate the total area covered by two overlapping rectangles on a 2-D coordinate plane.

  • Parse input coordinates for two rectangles

  • Calculate the area of each rectangle

  • Find the overlapping area by determining the intersection of the rectangles

  • Calculate the total area by adding the areas of both rectangles and subtracting the overlapping area

Add your answer
right arrow

Q12. Longest Repeating Subsequence Problem Statement

Given a string st, your task is to determine the length of the longest repeating subsequence such that no two subsequences have the same character at the same pos...read more

Ans.

The task is to find the length of the longest repeating subsequence in a string with no same characters at the same position.

  • Iterate through the string and find the longest repeating subsequence by comparing characters at different positions.

  • Use dynamic programming to keep track of the longest repeating subsequence found so far.

  • Ensure that no two subsequences have the same character at the same position.

  • Example: For input 'AABCBDC', the longest repeating subsequence is 'ABC' ...read more

Add your answer
right arrow

Q13. Find Magic Index in Sorted Array

Given a sorted array A consisting of N integers, your task is to find the magic index in the given array, where the magic index is defined as an index i such that A[i] = i.

Exam...read more

Ans.

Find the magic index in a sorted array where A[i] = i.

  • Iterate through the array and check if A[i] = i for each index i

  • Utilize binary search for a more efficient solution

  • Handle cases where there are multiple magic indices or none at all

Add your answer
right arrow

Q14. Palindrome Partitioning II Problem Statement

Given a string ‘str’, find the minimum number of partitions needed such that every segment of the string is a palindrome.

The task is to make cuts in the string to p...read more

Ans.

Find the minimum number of partitions needed in a string such that every segment is a palindrome.

  • Iterate through the string and check for palindromes at each possible partition point.

  • Use dynamic programming to keep track of the minimum cuts needed.

  • Consider edge cases where the string is already a palindrome or consists of different characters only.

Add your answer
right arrow

Q15. Maximum Difference Problem Statement

Given an array ARR of N elements, your task is to find the maximum difference between any two elements in ARR.

If the maximum difference is even, print EVEN; if it is odd, p...read more

Ans.

Find the maximum difference between any two elements in an array and determine if it is even or odd.

  • Iterate through the array to find the maximum and minimum elements

  • Calculate the difference between the maximum and minimum elements

  • Check if the difference is even or odd and return the result

Add your answer
right arrow

Q16. DFS Traversal Problem Statement

Given an undirected and disconnected graph G(V, E), where V is the number of vertices and E is the number of edges, the connections between vertices are provided in the 'GRAPH' m...read more

Ans.

DFS traversal problem on an undirected and disconnected graph to find connected components.

  • Perform Depth First Search (DFS) on each vertex to find connected components

  • Use a visited array to keep track of visited vertices

  • Print the number of connected components and list vertices in ascending order for each component

Add your answer
right arrow

Q17. Dijkstra's Shortest Path Problem

Given an undirected graph with ‘V’ vertices (labeled 0, 1, ... , V-1) and ‘E’ edges, where each edge has a weight representing the distance between two connected nodes (X, Y).

Y...read more

Ans.

Dijkstra's algorithm is used to find the shortest path from a source node to all other nodes in a graph with weighted edges.

  • Implement Dijkstra's algorithm to find the shortest path distances from the source node to all other nodes.

  • Use a priority queue to efficiently select the next node with the shortest distance.

  • Update the distances of neighboring nodes based on the current node's distance and edge weights.

  • Handle disconnected vertices by assigning a large value (e.g., 214748...read more

Add your answer
right arrow

Q18. Kth Largest Element Problem

Given an array containing N distinct positive integers and a number K, determine the Kth largest element in the array.

Example:

Input:
N = 6, K = 3, array = [2, 1, 5, 6, 3, 8]
Output...read more
Ans.

Find the Kth largest element in an array of distinct positive integers.

  • Sort the array in non-increasing order to easily find the Kth largest element.

  • Ensure all elements in the array are distinct for accurate results.

  • Handle multiple test cases efficiently by iterating through each case.

Add your answer
right arrow

Q19. Sort Linked List Based on Actual Values

Given a Singly Linked List of integers that are sorted based on their absolute values, the task is to sort the linked list based on the actual values.

The absolute value ...read more

Ans.

Sort a Singly Linked List based on actual values instead of absolute values.

  • Traverse the linked list and store the values in an array.

  • Sort the array based on actual values.

  • Update the linked list with the sorted values.

Add your answer
right arrow

Q20. How would I explain the concept of prime number to an illiterate?

Ans.

A prime number is a number that is divisible only by 1 and itself.

  • A prime number has exactly two factors: 1 and itself.

  • Prime numbers cannot be divided evenly by any other number.

  • Examples of prime numbers include 2, 3, 5, 7, 11, 13, 17, etc.

Add your answer
right arrow
Q21. What is hashing and how can it be implemented?
Ans.

Hashing is a process of converting input data into a fixed-size string of bytes using a hash function.

  • Hashing is used to securely store passwords by converting them into a hash value before storing in a database.

  • Hashing is used in data structures like hash tables to quickly retrieve data based on a key.

  • Common hash functions include MD5, SHA-1, and SHA-256.

  • Hashing can be implemented in programming languages like Python using libraries like hashlib.

Add your answer
right arrow

Q22. Suggest as many methods as possible for finding the nth largest element in an unsorted linked list

Ans.

Methods to find nth largest element in an unsorted linked list

  • Traverse the linked list and store elements in an array, sort the array and return the nth largest element

  • Use quickselect algorithm to find the nth largest element in O(n) time complexity

  • Implement a max heap and extract the nth largest element

  • Divide the linked list into smaller sublists and recursively find the nth largest element

  • Use merge sort to sort the linked list and return the nth largest element

Add your answer
right arrow

Q23. what is hashing and how will you implement?

Ans.

Hashing is a process of converting data into a fixed-size numerical value called a hash code.

  • Hashing is used to quickly retrieve data from large datasets.

  • It is commonly used in data structures like hash tables and hash maps.

  • Hash functions should be fast, deterministic, and produce unique hash codes for different inputs.

  • Examples of hash functions include MD5, SHA-1, and SHA-256.

Add your answer
right arrow
Q24. How would you design a rate limiter?
Ans.

Rate limiter can be designed using token bucket algorithm to control the rate of requests.

  • Use token bucket algorithm to control the rate of requests

  • Set a limit on the number of requests allowed within a certain time frame

  • Track the number of requests made and refill the bucket at a constant rate

  • Reject requests that exceed the limit

Add your answer
right arrow

Q25. Design classes for educational institutions in a city

Ans.

Design classes for educational institutions in a city

  • Identify the main entities: schools, students, teachers, courses

  • Create a School class with attributes like name, address, and a list of students and teachers

  • Create a Student class with attributes like name, age, and a list of courses

  • Create a Teacher class with attributes like name, specialization, and a list of courses

  • Create a Course class with attributes like name, duration, and a list of students and teachers

  • Establish rel...read more

Add your answer
right arrow

Q26. no of pairs between 1 and N satisfy relation pow(a,3)+pow(b,3)=pow(c,3)+pow(d,3).a,b,c,d<=N

Ans.

The question asks for the number of pairs between 1 and N that satisfy a specific mathematical relation.

  • The relation is pow(a,3) + pow(b,3) = pow(c,3) + pow(d,3)

  • The values of a, b, c, and d should be less than or equal to N

  • Count the number of pairs that satisfy the relation

Add your answer
right arrow

Q27. find the and return if the given file path existing in the given file hierarcy(file system).

Ans.

Check if a given file path exists in the file system hierarchy and return the result.

  • Use file system APIs to check if the given file path exists in the hierarchy.

  • Traverse the file system hierarchy starting from the root directory to find the given file path.

  • Return true if the file path exists, false otherwise.

Add your answer
right arrow

Q28. Show the abstraction and write code for function overriding

Ans.

Abstraction is hiding the implementation details, function overriding is providing a new implementation for a method in a subclass.

  • Abstraction involves hiding the complex implementation details and showing only the necessary features to the user.

  • Function overriding occurs in inheritance when a subclass provides a specific implementation for a method that is already defined in its superclass.

  • Example: Parent class 'Animal' has a method 'makeSound()', subclass 'Dog' overrides th...read more

Add your answer
right arrow

Q29. Give a few test cases for a bank transaction

Ans.

Test cases for a bank transaction

  • Transaction amount within account balance limit

  • Transaction amount exceeds account balance limit

  • Transaction to a valid account number

  • Transaction to an invalid account number

  • Transaction with correct transaction code

  • Transaction with incorrect transaction code

  • Transaction during bank working hours

  • Transaction outside bank working hours

Add your answer
right arrow

Q30. Optimal path cost and path in a matrix . Dynamic programming

Ans.

Finding optimal path cost and path in a matrix using dynamic programming.

  • Dynamic programming is a technique to solve problems by breaking them down into smaller subproblems and solving them recursively.

  • In this case, we can use dynamic programming to find the optimal path cost and path in a matrix.

  • We can start by defining a 2D array to store the minimum cost of reaching each cell in the matrix.

  • Then, we can use a recursive function to calculate the minimum cost of reaching the ...read more

Add your answer
right arrow

Q31. Program to implement Dijkstra’s algorithm

Ans.

Dijkstra's algorithm finds the shortest path between nodes in a graph.

  • Create a graph with nodes and edges

  • Assign a tentative distance to each node

  • Set the initial node as current and mark it visited

  • For each neighbor of the current node, calculate the tentative distance

  • If the tentative distance is less than the current distance, update the distance

  • Mark the current node as visited and select the unvisited node with the smallest tentative distance

  • Repeat until the destination node ...read more

Add your answer
right arrow

Q32. Program to reverse a singly linked list

Ans.

A program to reverse a singly linked list

  • Create a new empty linked list

  • Traverse the original linked list and insert each node at the beginning of the new list

  • Return the new list

Add your answer
right arrow

Q33. how to find cycle in graph

Ans.

To find a cycle in a graph, use depth-first search (DFS) and keep track of visited nodes.

  • Implement DFS algorithm to traverse the graph

  • Maintain a visited array to keep track of visited nodes

  • If a visited node is encountered again during DFS, a cycle exists

Add your answer
right arrow

Q34. How is MongoDB scalable?

Ans.

MongoDB is scalable due to its ability to horizontally partition data across multiple servers.

  • MongoDB uses sharding to distribute data across multiple servers.

  • Sharding allows for horizontal scaling by adding more servers to the cluster.

  • MongoDB also supports replica sets for high availability and fault tolerance.

  • Indexes can be created on any field in a MongoDB document, allowing for efficient querying of large datasets.

Add your answer
right arrow

Q35. What does Paypal do?

Ans.

Paypal is a digital payment platform that allows individuals and businesses to make online transactions.

  • Paypal provides a secure way to send and receive money online.

  • It allows users to link their bank accounts, credit cards, or debit cards to their Paypal account.

  • Users can make payments to merchants or individuals using their Paypal balance or linked payment methods.

  • Paypal offers buyer and seller protection, dispute resolution, and fraud prevention services.

  • It is widely used ...read more

Add your answer
right arrow

Q36. Write code for encryption of the code

Ans.

Encryption of code involves converting plaintext into ciphertext to secure data.

  • Choose a strong encryption algorithm like AES or RSA

  • Generate a key for encryption

  • Encrypt the plaintext using the key and algorithm

  • Store or transmit the ciphertext securely

Add your answer
right arrow

Q37. detecting loop in linked list

Ans.

Detecting loop in a linked list

  • Use two pointers, one moving one node at a time and the other moving two nodes at a time

  • If there is a loop, the two pointers will eventually meet

  • If any of the pointers reach the end of the list, there is no loop

Add your answer
right arrow

Q38. Explain Merge sort

Ans.

Merge sort is a divide-and-conquer algorithm that recursively divides an array into two halves, sorts them, and then merges them.

  • Divide the array into two halves

  • Recursively sort each half

  • Merge the sorted halves back together

  • Repeat until the entire array is sorted

Add your answer
right arrow

Q39. write code for dfs

Ans.

DFS (Depth-First Search) is a graph traversal algorithm that explores as far as possible along each branch before backtracking.

  • DFS uses a stack to keep track of visited nodes and explore adjacent nodes.

  • It can be implemented recursively or iteratively.

  • DFS is useful for solving problems like finding connected components, detecting cycles, and solving mazes.

Add your answer
right arrow

Q40. Rotten oranges problem - DS

Ans.

Rotten oranges problem involves finding the minimum time required to rot all oranges in a grid.

  • Use Breadth First Search (BFS) to traverse the grid and update the ripening time of neighboring oranges.

  • Keep track of the fresh oranges and the time taken to rot them all.

  • Handle edge cases like no fresh oranges or unreachable oranges.

Add your answer
right arrow

Q41. system design for parking lot

Ans.

Design a system for managing a parking lot efficiently.

  • Use a database to store information about available parking spots, vehicles, and payments.

  • Implement a system for tracking entry and exit of vehicles.

  • Include features like online booking, payment options, and real-time availability updates.

  • Consider implementing a ticketing system for managing parking duration and fees.

Add your answer
right arrow
Contribute & help others!
Write a review
Write a review
Share interview
Share interview
Contribute salary
Contribute salary
Add office photos
Add office photos

Interview Process at PayPal Software Engineer

based on 12 interviews
2 Interview rounds
Coding Test Round
Technical Round
View more
interview tips and stories logo
Interview Tips & Stories
Ace your next interview with expert advice and inspiring stories

Top Software Engineer Interview Questions from Similar Companies

Chetu Logo
3.3
 • 35 Interview Questions
RSA Logo
4.0
 • 14 Interview Questions
View all
Recently Viewed
INTERVIEWS
Company Interviews
No Interviews
INTERVIEWS
Cloud4C
No Interviews
INTERVIEWS
GrowthJockey
No Interviews
INTERVIEWS
Pregrad
No Interviews
INTERVIEWS
International Automotive Components
No Interviews
INTERVIEWS
Wissen Technology
No Interviews
SALARIES
Global Autotech
INTERVIEWS
ZF Steering Gear
No Interviews
INTERVIEWS
Mikuni
No Interviews
REVIEWS
Global Autotech
No Reviews
Share an Interview
Stay ahead in your career. Get AmbitionBox app
play-icon
play-icon
qr-code
Helping over 1 Crore job seekers every month in choosing their right fit company
75 Lakh+

Reviews

5 Lakh+

Interviews

4 Crore+

Salaries

1 Cr+

Users/Month

Contribute to help millions

Made with ❤️ in India. Trademarks belong to their respective owners. All rights reserved © 2024 Info Edge (India) Ltd.

Follow us
  • Youtube
  • Instagram
  • LinkedIn
  • Facebook
  • Twitter