# PayPal Interview Experience | SDE 1 (On-Campus)

• Difficulty Level : Hard
• Last Updated : 18 Aug, 2020

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```

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.

• All the characters in each of the splitted subarray must not be in another subarray
• Sample Output – {“aabaca”, “dfgrd”, “tyu”}

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

• Sample Input – [2, 5], [4, 7]
• Sample Output – True
• Sample Input – [2, 3], [4, 7]
• Sample Output – False

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

• Started with bubble sort – O(n^2) time
• Finalised with merge sort – O(nlogn) time
• Some other basic Computer Science questions on OS, DBMS, SQL etc
• Some questions based on my resume and my projects.
• Some more HR type questions

Final Round:

• K frogs are there with a number assigned. There is 1 long queue with numbers from 1 to n. Frog with number 2 can visit 2, 4,6,8… And so with other frogs. What are the numbers in the queue that won’t be visited after all the frogs have done their visit?
• A grid is present with many balloons. You have 1 arrow. What is the max no of balloons that u can shoot with that arrow? The angle of the shoot can be anything from 0 to 360 degrees.
• Similar Question: https://www.geeksforgeeks.org/count-maximum-points-on-same-line/

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:

• Don’t fake anything either in your resume or with your projects.
• Be honest in your resume and don’t mention things you don’t know
• Projects are an important part of the resume. Don’t mention projects done by your friends/ taken from GitHub
• Have a good understanding of OS, DBMS, Network, etc (core CS subjects)
• Be positive and have confidence in yourself

All the best for your interviews.

My Personal Notes arrow_drop_up