PayPal logo

PayPal Interview Questions

6 practice questions for PayPal technical interviews

PayPal software engineer interviews cover algorithms, data structures, system design, and coding problems drawn from real interview rounds.

Software Engineer Backend Engineer Frontend Engineer Full Stack Engineer Mobile Engineer Data Engineer Data Scientist ML Engineer DevOps Engineer DevOps Engineer Product Manager SRE Security Engineer Engineering Manager Data Analyst UX/UI Designer QA Engineer
coding Medium Verified Question #1

1. Student Grade Management System


Category: String coding problem

Question Design a student grade management system consisting of two classes: Student and Result. Student Class Implement a Student class...

Input: String
Output: Printed output
coding Medium tree #1

1. Binary Tree Depth Calculation — Calculate the maximum depth of a binary tree

Background: PayPal employs complex data structures to manage transaction workflows and user account hierarchies. Understanding the depth of binary trees can help optimize search operations in these systems.
Problem statement: Given a binary tree, determine its maximum depth. The function should return the number of nodes along the longest path from the root node down to the farthest leaf node. A leaf is a node with no children.
Function/class signature:
  • def max_depth(root: Optional[TreeNode]) -> int:


Example 1:
  • Input: root = [3,9,20,null,null,15,7]

  • Output: 3

  • Explanation: The maximum depth is 3 because the longest path is 3 -> 20 -> 15.


Example 2:
  • Input: root = [1,null,2]

  • Output: 2

  • Explanation: The maximum depth is 2 because the longest path is 1 -> 2.


Constraints:
  • Node count in the tree can range from 0 to 1000.

  • Each node's value is at most 1000.

  • root can be None for an empty tree.
coding Hard graph #2

2. Graph Traversal — Find the shortest path for a payment transaction

Background: PayPal handles a vast number of transactions daily, and optimizing the transaction routing is crucial for efficiency and speed. This problem relates to optimizing how payment transactions traverse through multiple gateways.
Problem statement: Given a directed graph where nodes represent payment gateways and edges represent the transaction routes with associated costs, you need to find the shortest path from a source gateway to a destination gateway. Return the total cost of the shortest path and the path itself as a list of gateways.
Function/class signature:
  • def find_shortest_payment_route(links: List[Tuple[str, str, int]], source: str, destination: str) -> Tuple[int, List[str]]:


Example 1:
  • Input: links = [("A", "B", 1), ("A", "C", 4), ("B", "C", 2), ("C", "D", 1)], source = "A", destination = "D"

  • Output: (4, ["A", "B", "C", "D"])

  • Explanation: The shortest path is through B and C with a total cost of 4.


Example 2:
  • Input: links = [("A", "B", 2), ("B", "D", 3), ("A", "C", 6), ("C", "D", 1)], source = "A", destination = "D"

  • Output: (5, ["A", "B", "D"])

  • Explanation: The optimal route is direct via B with a total cost of 5.


Constraints:
  • 1 ≤ number of links ≤ 1000

  • Cost of each route (edge weight) is positive and ≤ 1000

  • All nodes (gateways) are unique strings.
coding Hard graph #3

3. MAXIMUM FLOW — Calculate the maximum flow in a payment network

Background: In financial systems like PayPal, it is essential to optimize payment routes to ensure efficient transaction handling. The maximum flow algorithm helps in managing the flow of transactions through various payment channels.
Problem statement: You are given a directed graph where nodes represent payment channels, and edges represent possible transaction flows with capacity limits. Your task is to implement a function that computes the maximum flow from a source node to a sink node. You need to return the total maximum flow achievable from the source to the sink.
Function/class signature:
  • def maximum_flow(graph: List[List[int]], source: int, sink: int) -> int:


Example 1:
  • Input: graph = [[0, 16, 13, 0, 0, 0], [0, 0, 10, 12, 0, 0], [0, 4, 0, 0, 14, 0], [0, 0, 9, 0, 0, 20], [0, 0, 0, 7, 0, 4], [0, 0, 0, 0, 0, 0]], source = 0, sink = 5

  • Output: 23

  • Explanation: The maximum flow from source (0) to sink (5) is 23.


Example 2:
  • Input: graph = [[0, 10, 5, 15], [0, 0, 15, 5], [0, 0, 0, 10], [0, 0, 0, 0]], source = 0, sink = 3

  • Output: 20

  • Explanation: The maximum flow for this network is 20.


Constraints:
  • 2 <= graph.length <= 100

  • 0 <= graph[i][j] <= 1000

  • source and sink are valid indices in graph, with source != sink.
coding Medium graph #4

4. Graph — Find the Shortest Payment Path


Background: In financial transactions, finding the shortest path for payments between two linked financial institutions can optimize transaction processing. This relates to PayPal’s payment system, aiming to minimize transaction fees and times.
Problem statement: Given a directed acyclic graph where nodes represent financial institutions and edges represent transaction fees between them, write a function to find the minimum transaction fee necessary to transfer money from a starting institution to a target institution. The output should indicate both the minimum fee and the path taken.
Function/class signature:
  • def find_minimum_fee_path(start: str, target: str, edges: List[Tuple[str, str, int]]) -> Tuple[int, List[str]]:


Example 1:
Input: start = "A", target = "C", edges = [("A", "B", 1), ("B", "C", 2), ("A", "C", 5)]
Output: (3, ["A", "B", "C"])
Explanation: The minimum fee from A to C is through B with a total fee of 3 (1 + 2).
Example 2:
Input: start = "A", target = "D", edges = [("A", "B", 4), ("B", "C", 2), ("C", "D", 1), ("A", "D", 10)]
Output: (7, ["A", "B", "C", "D"])
Constraints:
  • The graph will have at most 100 nodes.

  • Each edge's transaction fee will be a positive integer not exceeding 100.

  • There may be multiple edges between two nodes but only one directional path exists in the graph.

  • Node names will consist of uppercase letters only.
coding Hard graph #5

5. CODING — Longest Path in a Directed Acyclic Graph

Background: PayPal relies on robust data processing workflows that often involve directed acyclic graphs (DAGs) for transaction processing and workflow automation. Optimizing these workflows is crucial for efficiency and accuracy.
Problem statement: Given a directed acyclic graph represented as an adjacency list, write a function to determine the length of the longest path from any starting node to any ending node. Implement it with a focus on efficiency due to large transaction sets.
Function/class signature:
  • def longest_path_dag(graph: List[List[int]]) -> int:

Example 1:
  • Input: graph = [[1,2],[3],[3],[]]

  • Output: 4

  • Explanation: The longest path is 0 -> 1 -> 3, which has a length of 4.

Example 2:
  • Input: graph = [[1],[2],[3],[]]

  • Output: 3

  • Explanation: The longest path is 0 -> 1 -> 2 -> 3, which has a length of 3.

Constraints:
  • 1 <= graph.length <= 1000

  • 0 <= graph[i].length <= 1000

  • 0 <= graph[i][j] < graph.length

  • No duplicate edges.

Start practicing PayPal questions

Sign up for free to access walkthroughs, AI-generated questions, and more.

Get Started Free