Question bank › Sorting
Dsa Sorting Easy

Synchronized Log Jitter Repair

A distributed system produces logs with timestamps in HH:MM:SS format. Due to network jitter, logs within the same second may arrive out of order. You must sort the logs using three criteria: 1. Chronologically by timestamp (ascending). 2. For the same timestamp, by priority level (4=CRITICAL, 3=ERROR, 2=WARNING, 1=INFO) in descending order. 3. For the same timestamp and priority, lexicographically by the message (ascending). Input Format: - An integer N, the number of logs. - N lines, each containing 'timestamp priority message'. Output Format: - The sorted messages only, one per line. Example: Input: 3 10:00:01 2 Disk-Near-Full 10:00:00 4 Kernel-Panic 10:00:01 3 Write-Error Output: Kernel-Panic Write-Error Disk-Near-Full

Key concepts

multi-level sortingstring parsing

Practise this out loud — free

Start a mock interview on THIS exact question — a voice AI interviewer opens with it, pushes back like a real onsite, then hands you an instant scorecard.

🎙 Practise this question now
Part of Praxari's verified interview question bank. We show the prompt and concepts to practise with — never a copy-paste solution.