BackmediumUncategorized uncategorized medium

Sorted Message Timeline Solution

Problem Statement

Given a list of messages with unique identifiers and timestamps, determine the correct order of processing to maintain timeline integrity.

Example 1
Input
[{"id":1,"timestamp":3},{"id":2,"timestamp":1},{"id":3,"timestamp":2}]
Output
[2,3,1]

Explanation: The output is sorted by timestamp in ascending order

Constraints

  • {"type":"array length","name":"messages","min":1,"max":10000}
  • {"type":"timestamp range","name":"timestamp","min":0,"max":1000000}
Live Compiler
Loading...
Test Cases & Output
🔒 Sign up to run your code

🚀 Practice this problem

Run code, get AI hints & track streak

Sign Up Free