Log Report
Hard · Scripts · grep · wc · Functions · Pipelines
Problem
app.log has lines beginning with a level: INFO, WARN or ERROR.
Print a report — one line per level, in that order — as : . Then print worst: , naming the most severe level that actually occurs (ERROR over WARN over INFO), or worst: none if the log is empty.
Examples
Input: 2 INFO, 1 ERROR Output: INFO: 2 WARN: 0 ERROR: 1 worst: ERROR
Approaches
- A counting function, then a severity ladder
Start free on Cariara · Coding problems · System design studio