Test Cases
Case 1
Case 2
Case 3
Input
["pizza", "burgers", "pizza", "burgers", "pizza", "pizza"]
Output
"pizza"
A restaurant is analyzing feedback from customers to determine the most popular dish. Given a list of dish names that customers have voted for, write a function to find the dish that has been ordered the most. If there is a tie, return any one of the most frequently ordered dishes.
Example 1
Input: ["pizza", "burgers", "pizza", "burgers", "pizza", "pizza"]
Output: "pizza"
Example 2
Input: ["pasta", "pasta", "burgers", "pasta", "pizza", "burgers", "pasta", "pasta", "pasta"]
Output: "pasta"
Example 3
Input: ["sushi", "pizza", "sushi", "sushi", "pizza", "sushi"]
Output: "sushi"
1 <= votes.length <= 10^4
votes
array consists of non-empty strings.Input
Output