Expedia Online Test for SDE-2

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)

Write your Interview Experience or mail it to contribute@geeksforgeeks.org

My Personal Notes arrow_drop_up

If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.

Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.

Article Tags :
Practice Tags :

Be the First to upvote.

Please write to us at contribute@geeksforgeeks.org to report any issue with the above content.