Distinct Hotel Cities

Easy
Deduplication

Distinct Hotel Cities

The hotels table contains hotel locations.

Return each distinct city once, sorted alphabetically.

Browser Engine: Evaluates PySpark DataFrame & SQL logic locally in Pyodide WebAssembly.

Input data

1 DataFrame

These DataFrames are passed to solve(spark, dfs). Access one with dfs['name'].

df.hotels6 rows
hotel_id (int)city (string)
1Mumbai
2Delhi
3Mumbai
4Pune
5Delhi
6Goa

Return these columns

city(string)

Column names and order must match. Sort order is specified in the question.

Browser engine
Loading Python editor…
Click Run to try the sample cases, or Submit to check the hidden cases. First run caches the browser Python engine (~8–15s once); all code stays on your device.