Expedia Online Test for SDE-2
There were three questions that were asked in the Hackerrank test.
1. Device Name System Suggested Problem Name:
Hey geek! It's time to become a success story instead of reading them. Check out our most renowned DSA Self Paced Course, now at a student-friendly price and become industry ready. And if you are looking for a more complete interview preparation resource, check out Complete Interview Preparation Course that will prepare you for the SDE role of your dreams!
Feeling prepared enough for your interview? Test your skills with our Test Series that will help you prepare for top companies like Amazon, Microsoft, TCS, Wipro, Google and many more!
Create unique device names to be used in a residential loT (Internet of Things) system. If a device name already exists in the system, an integer number is added at the end of the name to make it unique. The integer added starts with 1 and is incremented by 1 for each new request of an existing device name. Given a list of device name requests, process all requests and return an array of the corresponding unique device names.
-> I solved it using a map<string, int> which stores the count of each unique string and would append it to the name.
2. Write a Comparator class with 3 overloaded function:
a. boolean compare(int a, int b). Return true if same else return false.
b. boolean compare(string a, string b). Return true if same else return false.
c. boolean compare(vector<int> a, vector<int> b), Return true if following is met:
- – Both array have same length
- – Elements are same at every index
3. Maximum Sum Sebsequence:
We have an array of n elements (1 <= n <= 60) We have to determine whats the maximum sum subsequence possible that is less than or equal to a value k (1 <= k <= 10^18). At most 15 of the elements in array, either a[i] >= 2*a[j] or a[j] >= 2*a[i] where j is not equal to i (1 <= a[i] <= 10^17)