Open In App

PayPal Interview Experience | SDE 1 (On-Campus)

Online Assessment: 2 Questions – 120 Minutes

Question 1 – Coloring nx3 board with 3 colors



An automated painting system needs a program that can paint an n x 3 grid in red, green and blue such that no row or column contains cells that are all the same color. Determine the number of valid patterns that can be painted given n rows. Since the number of patterns can be large, return the value modulo (10^9 + 7)

Sample Input: n = 4
Sample Output: 296490

Link (Same question): https://math.stackexchange.com/questions/3215805/coloring-a-3-times-n-board-using-3-colors



Question 2 – Social Media Connections

Social media connections can serve as a means of recognizing relationships among a group of people. These relationships can be represented as an undirected graph where edges join related people. A group of n social media friends is uniquely numbered from 1 to friend_nodes. The group of friends is expressed as a graph with friend_edges undirected edges, where each pair of best_friends is directly connected by an edge. A trio is defined as a group of three best friends. The friendship score for a person in a trio is defined as the number of best friends that person has outside the trio. The friendship sum for a trio is the sum of the trio’s friendship scores.

Given friendship connection data, create an undirected graph, and determine the minimum friendship sum for all trios of best friends in the group. If no such trio exists, return -1

Example Input:
friend_nodes = 6
friend_edges = 6
friends_from = [1, 2, 2, 3, 4, 5]
friends_to = [2, 4, 5, 5, 5, 6]
Example Output: 3

Explanation:

Trio formed is among {2, 4, 5}
Friends of 2 other than 4,5 are {1} => total count = 1
Friends of 4 other than 2,5 are {} => total count = 0
Friends of 5 other than 2,4 are {3, 6} => total count = 2
Sum of total count = 3

Technical Round 1

1. Split array into subarray with given conditions.

2. Are the given 2 intervals intersecting? (fully optimized)

Technical Round 2:

1. Find the word that comes more than 1 time in a string (Case Insensitive)

(Output the first occurrence of the word)

Sample Input - "Paypal is a good company but PayPal hires more than once"
Sample Output - ["Paypal"]

2. Any sorting algo (bubble sort) with time complexity, then optimize or use some faster algo with time complexity

Final Round:

My all rounds were good and solved most of the questions in one attempt. 3rd round was worst and was not able to solve any questions : (

My suggestions:

All the best for your interviews.

Article Tags :