Code RoomPad or truncate row
EasyPrep Room Coding #379

Pad or truncate row

CodingDatabases & SQLAlgorithms & data structuresEntry–Mid~11 min

A report generator needs every data row to have exactly `size` columns. Given a row of integers, a required size (size >= 0), and a fill value, return the row adjusted to that exact length: if it is too short, append the fill value until it fits; if it is too long, keep only the first `size` entries; if it already fits, return it unchanged. Example: [1, 2] with size 4 and fill 0 becomes [1, 2, 0, 0].

Implement
fit_to_length(row: list[int], size: int, fill: int) → list[int]
Examples
in[[1,2],4,0]out[1,2,0,0]
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
InputExpectedGot
[[1,2],4,0][1,2,0,0]not run yetsample