Expedia Group Interview Experience for SDE-2 | 1.5 Years Experienced
Coding Round 1:
Given a list of strings, words may repeat. Add numbers of times word is repeated along with word as suffix if repeated.
Input – [‘Cat’, ‘Dog’, ‘Apple’, ‘Cat’, ‘Apple’, ‘Cat’] Output – [‘Cat, ‘Dog’, ‘Apple’, ‘Cat1’, ‘Apple1’, ‘Cat2’]
Given a bidirectional graph and a start point. Print all vertices in order of their distance from the source vertex. If two vertices have the same distance for the source, print the smaller one first.
Input – Source: 1 Graph: 1 --------(2,3). Both 2 and 3 are connected to 1 Output – [1, 2, 3]
Given a list of strings, for each string find several substrings that can be palindrome by rearranging characters of the substring.
Input – [‘Apple’, ‘racecar’] Output – [6, 7]
Round 2: An API rate limiting algorithm.
window = 2 hours rateLimit = 100 12:05pm -> whether in the last 2 hours -> < 100 calls accepted -> request goes through= 100 calls -> reject rate Limit = 3 window =2 12:10 ; 12:20 ; 13:20 ; 13:30 -> rejected 12:10 ; 12:20 ; 13:20 ; 15:00 -> accepted int window = 2; // unit->hours int rate Limit = 100; true -> allow false -> reject
Case 1: Complete this Boolean apiLimit function:
boolean api Limit(Request request) {
}
Example – window = 2;
rateLimit = 3
12:10 ; 15:10
Case 2: Given a class Status, return Status object for API limit Method
class Status {
boolean accepted;
int remaining capacity; // how many more requests can be accepted at this time
}
Status apiLimit(Request request) {
}
Round 2:
- https://leetcode.com/problems/longest-palindrome-by-concatenating-two-letter-words/
Round 3: On forums like Reddit, comments can reply to each other and be nested. They are represented in nested threads. See https://old.reddit.com/r/math/comments/4lbxlf/a_geometric_haircut/
For example: Given a list of comments (with id, parent id, and message), print all comments in a threaded manner. eg. For the following input (assume parent id of 0 means no parent):
id, message, parent, votes 1,first comment,0,10 2,second comment,0,5 3,first reply,1,100 4, second reply,3,13
The output could be:
1 first comment 3 first reply 4-second reply 2-second comment