Compute most popular location with weights
MicrosoftSoftware Engineer · Technical ScreenLast updated
This question evaluates a candidate's ability to perform weighted aggregation, data cleaning, tie-breaking logic, and handling of malformed or missing text fields using SQL and/or Python.
You are given a dataset of voting records for concert locations. Each record includes voter_id, location_text, and an optional numeric weight (default 1). Write SQL and/or Python to compute the most popular location by total vote weight. Explain how you handle ties, missing or malformed location_text, and verify correctness with a small example. Analyze the time and space complexity of your solution.
Solution walkthrough is for members
Get the full walkthrough with reference code and complexity analysis, plus Kitty Coach at 300 messages a day. Hints, the code runner and community answers stay free.