Paint a board: given a matrix whose cells all start as 'O', draw a line from (x0, y0) to (x1, y1), marking the cells the line passes through. A perfect diagonal such as (0,0) to (3,3) is straightforward, but you must also handle a non-45-degree line such as (0,0) to (4,7). Asked in the onsite coding round 2 stage. The author warns this interviewer was a former Microsoft imaging engineer and reuses this question.
Implement draw_line(board, x0, y0, x1, y1). Coordinates use board[y][x]; mutate and return the board, replacing every rasterized cell with 'X'. Use integer rasterization and include both endpoints. Inputs contain at least one row, and all coordinates are valid.
def draw_line(board, x0, y0, x1, y1):