Find Long-Running Processes
Given a process listing, print the processes that have been running for more than 1 hour.
Input
A single argument: the path to a file. The first line is a header, followed by one process per line:
PID USER ELAPSED COMMAND
1201 root 35 nginx
1334 deploy 420 worker
1455 postgres 86400 postgres
1521 deploy 7200 python
1602 root 12 sshd
ELAPSED is the number of seconds the process has been running.
Output
Print <PID> <COMMAND> for every process whose ELAPSED is greater
than 3600 seconds, sorted from longest-running to shortest-running;
ties broken by PID ascending.
Constraints
- The file has at most 100,000 lines, including the header.
- The header line is always exactly
PID USER ELAPSED COMMAND. ELAPSEDis a non-negative integer.COMMANDcontains no whitespace.
Example
Input:
PID USER ELAPSED COMMAND
1201 root 35 nginx
1334 deploy 420 worker
1455 postgres 86400 postgres
1521 deploy 7200 python
1602 root 12 sshd
Output:
1455 postgres
1521 python