The longest completed Mars mission lasted 1,629 days. Its security code is XRT-421-ZQP.
The command
This command downloads the source log, trims spacing around fields, requires exactly eight fields, and compares durations as numbers. It prints the security code.
curl -fsSL https://raw.githubusercontent.com/warpdotdev/hiring-challenge/refs/heads/main/space_missions.log |
awk -F '|' '
function trim(s) { gsub(/^[[:space:]]+|[[:space:]]+$/, "", s); return s }
NF == 8 && trim($3) == "Mars" && trim($4) == "Completed" {
days = trim($6)
if (days ~ /^[0-9]+$/ && days + 0 > max) {
max = days + 0
code = trim($8)
}
}
END { print code }
'
Output: XRT-421-ZQP
Data Validation
Both charts use the 975 eight-field records whose destination is Mars, status is Completed, and duration is numeric. Surrounding spaces are removed before measuring the duration’s digit count. A separate scan found no Mars/Completed candidates excluded by field count or a nonnumeric duration.
1629.