You are given a 90-minute online assessment containing three coding questions. Implement solutions for all questions.
Given an array of strings strs, group the strings into lists where each list contains strings that are anagrams of each other.
strs
: array of lowercase strings (may include duplicates)
1 <= len(strs) <= 10^4
0 <= len(strs[i]) <= 100
Given a non-negative integer num, you may swap at most one pair of its digits (or perform no swap). Return the maximum value you can obtain.
num
: non-negative integer
0 <= num <= 10^8
You are given:
hotel_id
.
k
.
Compute each hotel’s total sentiment score by scanning all its reviews.
Return the top k hotel IDs ranked by:
hotel_id
first
positive_keywords
: string or list of words
negative_keywords
: string or list of words
hotel_ids
: array of integers, parallel to
reviews
reviews
: array of strings
k
: integer
k
hotel IDs in sorted ranking order
1 <= len(reviews) == len(hotel_ids) <= 10^5
10^6
1 <= k <= number_of_distinct_hotels
k
hotels (in some variants), return all hotels sorted by the same rule.