-
-
Notifications
You must be signed in to change notification settings - Fork 262
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Top K frequent words question added #344
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Small changes suggested, do have a look 😄
@@ -0,0 +1,18 @@ | |||
<h1>Problem Statement</h1> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we swap out the h1 tag with "#"?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we also rename this file to question.md?
/* | ||
Given an array of strings words and an integer k, return the k most frequent strings. | ||
|
||
Return the answer sorted by the frequency from highest to lowest. Sort the words with the same frequency by their lexicographical order. | ||
|
||
|
||
|
||
Example 1: | ||
|
||
Input: words = ["i","love","leetcode","i","love","coding"], k = 2 | ||
Output: ["i","love"] | ||
Explanation: "i" and "love" are the two most frequent words. | ||
Note that "i" comes before "love" due to a lower alphabetical order. | ||
Example 2: | ||
|
||
Input: words = ["the","day","is","sunny","the","the","the","sunny","is","is"], k = 4 | ||
Output: ["the","is","sunny","day"] | ||
Explanation: "the", "is", "sunny" and "day" are the four most frequent words, with the number of occurrence being 4, 3, 2 and 1 respectively.*/ | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can get rid of this comment, as it is present as a part of the markdown file
} | ||
|
||
}; | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add a newline at EOF
No description provided.