Skip to content
Related Articles

Related Articles

Improve Article
Expedia Online Test for SDE-2
  • Difficulty Level : Medium
  • Last Updated : 09 Jul, 2020

There were three questions that were asked in the Hackerrank test.

1. Device Name System Suggested Problem Name: 

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)

Attention reader! Don’t stop learning now. Get hold of all the important DSA concepts with the DSA Self Paced Course at a student-friendly price and become industry ready. To complete your preparation from learning a language to DS Algo and many more, please refer Complete Interview Preparation Course. In case you are prepared, test your skills using TCS, Wipro, Amazon and Microsoft Test Serieses.

My Personal Notes arrow_drop_up
Recommended Articles
Page :