Expedia Group interview question

Duplicate in arrays , sort map based on frequency