[ INFO ]category: Behavioral · Onsite difficulty: difficult freq: first seen: 2021-05-08
[DIFFICULT][ONSITE]OnsiteSWE II (Mid-Level)Rejected
$catproblem.md
The interview process at PayPal consisted of three rounds, each with a knockout basis. The first round was a HackerEarth online test lasting 1 hour and 15 minutes. It included two questions:
Given an array of size N and K queries, find the number of segments containing the index (from queries) which is leftmost or rightmost and the number at the index is greater than or equal to each element of that segment. For example, arr[] = [1, 2, 3] K = [3] -> o/p : 3 ([3], [2, 3], [1, 2, 3]).
A modification of the Leetcode problem "Find K Closest Elements".
I successfully cleared this round.
The second round was a face-to-face interview lasting 1 hour. It included two questions:
Given an array and a target sum k, find all a[i] + a[j] = k (follow up: handle if the array has both duplicate and non-duplicate elements).
Find the first non-repeating character in the string (with only lowercase letters). This is a Leetcode problem titled "First Unique Character in a String". The follow-up questions were: i) contains both lowercase & uppercase ii) case-insensitive & case sensitive iii) in O(1) space complexity if a sorted string is given.
I cleared this round as well.
The third round was another face-to-face interview lasting 1 hour. It included three questions:
Determine if a linked list is a palindrome. The expected time and space complexity is O(n) and O(1). This is a Leetcode problem titled "Palindrome Linked List".
Find the diameter of a binary tree. This is a Leetcode problem titled "Diameter of Binary Tree".
Validate if a tree is a BST. This is a Leetcode problem titled "Validate Binary Search Tree".
Unfortunately, I was rejected after this round.
My observations: The interviewers emphasized explaining the logic and approach before coding. They required the most optimal solution in terms of time and space complexity. If a brute-force or sub-optimal solution was presented, I was asked to think of a better solution before coding. If I couldn't come up with a solution within 20 minutes, the current question was put on hold, and the next question was asked. A thorough understanding of time and space complexity is essential.