Tavant interview question

Hive query