Latest Top 100 News Stories
Problem statement
storyIds[i] identifies a unique story whose latest history timestamp is updatedAt[i]. Return up to 100 IDs ordered by descending timestamp, breaking ties by lexicographically smaller ID.
Function
latestStories(storyIds: String[], updatedAt: long[]) → String[]Examples
Example 1
storyIds = ["b","a","c"]updatedAt = [5,5,7]return = ["c","a","b"]c is newest; a and b tie and sort by ID.
Constraints
- Arrays have equal length.
- IDs are unique.
- At most
10^5stories.