theconqueror
BAN USER- 2of 2 votes
AnswersYou have rating (0-10) of the hotels per user in this format:
- theconqueror in United States
scores = [
{'hotel_id': 1001, 'user_id': 501, 'score': 7},
{'hotel_id': 1001, 'user_id': 502, 'score': 7},
{'hotel_id': 1001, 'user_id': 503, 'score': 7},
{'hotel_id': 2001, 'user_id': 504, 'score': 10},
{'hotel_id': 3001, 'user_id': 505, 'score': 5},
{'hotel_id': 2001, 'user_id': 506, 'score': 5}
]
Any given hotel might have more than one score.
Implement a function, get_hotels(scores, min_avg_score) that returns a list of hotel ids that have average score equal to or higher than min_avg_score.
get_hotels(scores, 5) -> [1001, 2001, 3001]
get_hotels(scores, 7) -> [1001, 2001]
*/
How to solve this in C++ and Python?| Report Duplicate | Flag | PURGE
Google Software Engineer - 0of 0 votes
AnswersThere is an input log file given as follows-
- theconqueror in United States
log = [
{ 'user': 'A', 'page': 1},
{ 'user': 'B', 'page': 5},
{ 'user': 'A', 'page': 2},
{ 'user': 'A', 'page': 1},
{ 'user': 'B', 'page': 2},
{ 'user': 'C', 'page': 7},
{ 'user': 'C', 'page': 3},
{ 'user': 'A', 'page': 3},
{ 'user': 'C', 'page': 1},
]
please implement
discover_site_map(log)
discover_site_map returns a representation of the links between pages, using whatever data structure you think is suitable:
1 -> 2, 3
2 -> 1
3 -> 1
5 -> 2
7 -> 3
How to solve this in C++ and Python?| Report Duplicate | Flag | PURGE
Amazon Software Engineer - 0of 0 votes
AnswersYou have rating (0-10) of the hotels per user in this format:
- theconqueror in United States
scores = [
{'hotel_id': 1001, 'user_id': 501, 'score': 7},
{'hotel_id': 1001, 'user_id': 502, 'score': 7},
{'hotel_id': 1001, 'user_id': 503, 'score': 7},
{'hotel_id': 2001, 'user_id': 504, 'score': 10},
{'hotel_id': 3001, 'user_id': 505, 'score': 5},
{'hotel_id': 2001, 'user_id': 506, 'score': 5}
]
Any given hotel might have more than one score.
Implement a function, get_hotels(scores, min_avg_score) that returns a list of hotel ids that have average score equal to or higher than min_avg_score.
get_hotels(scores, 5) -> [1001, 2001, 3001]
get_hotels(scores, 7) -> [1001, 2001]
*/
How to solve this in C++ and Python?| Report Duplicate | Flag | PURGE
Amazon Software Engineer Algorithm - 0of 0 votes
AnswersGiven k - which is the number of bits, print all the possible combinations of numbers formed by printing all numbers with one bit set, followed by two bits set, ... upto the point when all k-bits are set. They must be sorted according to the number of bits set, if two numbers have the same number of bits set then they should be placed as per their value.
- theconqueror in India
For example if K=3
Output:
000, 001, 010, 100,101, 110, 011, 111
0 bits set, followed by 1 bits set followed by 2 bits set followed by 3 bits set.| Report Duplicate | Flag | PURGE
Google Algorithm