Draw as straight of a line as possible between the start and end coordiantes. You should return a path of 1s from the start to end coordinate.
def drawLine(M:int,N:int,start:tuple[int,int],end:tuple[int,int]) -> [[int]]:
passFor example:
# Example 1
start=(0,0)
end=(8,2)
M,N=9,5
[
[1,0,0,0,0],
[1,0,0,0,0],
[1,0,0,0,0],
[0,1,0,0,0],
[0,1,0,0,0],
[0,1,0,0,0],
[0,0,1,0,0],
[0,0,1,0,0],
[0,0,1,0,0]
]
# Example 2
M,N=7,5
start=(6,0)
end=(4,4)
expected=[
[0,0,0,0,0],
[0,0,0,0,0],
[0,0,0,0,0],
[0,0,0,0,0],
[0,0,0,1,1],
[0,0,1,0,0],
[1,1,0,0,0]
]
# Example 3
M,N=4,5
start=1,0
end=1,4
expected=[
[0,0,0,0,0],
[1,1,1,1,1],
[0,0,0,0,0],
[0,0,0,0,0]
]This line should be as straight of a line as possible from the start to end coordinate. Consider edge cases.