Sort Social Media Feed (For generic maybe :)
Sorting social media feeds by user and timestamp enhances user experience by ensuring posts are organized in a meaningful way. You are given a social media feed with entries containing various data, timeStamp, userId, and post, and your task is to sort these entries first based on user and then chronologically.
Write a function sortSocialMediaFeed that takes in a list of string, where each string is comma-separated value representing a post with timeStamp (a string representing Unix time), userId, and post. The function should return the feed sorted first by userId and then by timeStamp for each user.
Complete the function sortSocialMediaFeed in the editor.
sortSocialMediaFeed has the following parameter(s):
string feed[n]: a list of comma-separated strings where each string contains timeStamp, userId, and post, representing the data of social media posts
Returns
string[n]: the social media posts ordered first by userId and then by timeStamp
1Example 1
Constraints
Limits and guarantees your solution can rely on.
๐
๐