''' We want to implement a feature to suggest to users the cheapest hotel that is more popular than the one they are looking at. Write a function that given an array of hotels, sorted by their popularity returns a map from the hotel ids that associates each hotel with the cheapest hotel that is more popular than the one in question. if there is no hotel that is cheaper and more popular than the one with that id, then it shouldn't be put in the map. You can assume that hotel ids and prices are integers and that hotels have the following format: struct hotel{ int id; int price; } Example 1: input = [ { id => 123, price => 200 }, # Most popular { id => 55, price => 150 }, # Second most popular { id => 17, price => 70 }, # Third most popular { id => 18, price => 500 }, # ... { id => 27, price => 270 }, { id => 101, price => 230 } # Least popular ] output = { 18 : 17, 27 : 17, 101 : 17 }
Engineer Software Interview Questions
512,496 engineer software interview questions shared by candidates
The question was: Given a text written in some language where the alphabets are represented with 1 byte or 2 byte. But the one byte alphabets always have their MSB 1 and the 2 byte charecters always have their MSB 0. Now when at some point user presses a back space how many bytes are to be deleted to erase the alphabet?
Logic based questions. Scenarios. Code reviews
This function performs a basic smoothing of inlist and returns the result (outlist). Both lists have the same length, N. Each item in inlist is assumed to have type 'float', and 'h' is assumed to be an integer. For each i, outlist[i] will be the average of inlist[k] over all k that satisfy i-h <= k <= i+h and 0 <= k <= N-1.
Write a function that returns the longest palindrome in a string. Not just the first one or any palindrome, but the longest. The String is a long sequence of characters, spaces included.
Find a duplicate integer in a list of length K with integers 1...K-1 and one duplicate. Do so in O(n) time with constant space.
Write a function that takes a String as a parameter. Count the number of A's in the String before you reach a C.
Suppose you are going from a jungle in your jeep. One of the wheel comes off its axel. All the wheels have 4 nut each to hold on to the axel. You dont have any mechanic shop near by. The place is dangerous so you cant go walking. How will you fix your car and resume your journey.
Write a function that reverses the letters in each word using only one char buffer. E.g.: "I work at Microsoft" to "I krow ta tfosorciM"
how can a particular application be tested apart from testing its functionality
Viewing 2351 - 2360 interview questions