A legacy system writes fixed-width records. Parse them into dictionaries, trimming padding and skipping malformed lines.
lines["0012Mumbai ", "0013Pune ", "bad"]
layout[["id", 0, 4], ["city", 4, 8]]
| id | city |
|---|---|
| 0012 | Mumbai |
| 0013 | Pune |
lines[" a bb "]
layout[["first", 0, 5], ["second", 5, 5]]
| first | second |
|---|---|
| a | bb |
Community-reported interview topic. Not an official company question and no affiliation is implied.
Run against the public tests, or submit to score against all of them.