Most crashed device model
A crash-reporting service stores one line per crash as "<device_model> <os_version>", for example "pixel8 14". Product wants to know which device model is generating the most crash reports. Given at least one line, return the model with the highest number of reports; if several models tie, return the alphabetically smallest model name. The OS version is irrelevant to the count — every line is one crash for its model.
Implement
crashiest_model(lines: list[str]) → strExamples
in
[["pixel8 14","iphone15 17","pixel8 15"]]out"pixel8"What a strong answer looks like
State your approach and its time/space complexity out loud before you optimize. Handle the edge cases (empty input, duplicates, overflow), and say why you chose this over the brute force. Green tests are the floor, not the grade.
0:00 of about 10 min
solution.py
InputExpectedGot
[["pixel8 14","iphone15 17","pixel8 15"]]"pixel8"not run yetsample