Fill forward attendance
A teacher's attendance sheet is a day-ordered list of status strings such as "present" or "late", but days the teacher forgot to record are the empty string "". Clean the column by filling forward: replace each missing entry with the most recent recorded status. If the sheet starts with missing days (nothing to carry yet), use `fallback` for those. Example: (["present", "", "late", ""], "absent") gives ["present", "present", "late", "late"].
Implement
fill_forward(log: list[str], fallback: str) → list[str]Examples
in
[["present","","late",""],"absent"]out["present","present","late","late"]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 11 min
solution.py
InputExpectedGot
[["present","","late",""],"absent"]["present","present","late","late"]not run yetsample