given the fully functioned largest_at_position and longest_chain. Do not use any imports, do not use dictionaries - def longest_chatn(lst): result - [] while(i def largest in_matrix(matrix:...


given the fully functioned largest_at_position and longest_chain.


Do not use any imports, do not use dictionaries


- def longest_chatn(lst):<br>result - []<br>while(i < len(lst) and Ist[t] = 1):<br>result.append(Lst[1])<br>i + 1<br>return sur (result)<br>- def largest_at_postion(m, x, y):<br>x_nax = longest_chain(n[x][y:]);<br>result - x_max<br>while(i < len(m) and m[t][y] == 1):<br>x_nax - i (longest chaln(m[tjty:]), x_nax)<br>result = na (result, x_max (t-x+1))<br>return result<br>if<br>name<br>casei<br>main<br>[[1,0,1,0,01, [1,0,1,1,1], [1,1,1,1,1], [1,0,0,1,0]]<br>print(largest_at_position(case1, 0, 0))<br>print(largest_at_postion(case1, 2, 0))<br>print(largest_ at_position(case1, 1, 2))<br>

Extracted text: - def longest_chatn(lst): result - [] while(i < len(lst)="" and="" ist[t]="1):" result.append(lst[1])="" i="" +="" 1="" return="" sur="" (result)="" -="" def="" largest_at_postion(m,="" x,="" y):="" x_nax="longest_chain(n[x][y:]);" result="" -="" x_max="" while(i="">< len(m)="" and="" m[t][y]="=" 1):="" x_nax="" -="" i="" (longest="" chaln(m[tjty:]),="" x_nax)="" result="na" (result,="" x_max="" (t-x+1))="" return="" result="" if="" name="" casei="" main="" [[1,0,1,0,01,="" [1,0,1,1,1],="" [1,1,1,1,1],="" [1,0,0,1,0]]="" print(largest_at_position(case1,="" 0,="" 0))="" print(largest_at_postion(case1,="" 2,="" 0))="" print(largest_="" at_position(case1,="" 1,="">
def largest in_matrix(matrix: list[list[int]]) -> int:<br>Returns the area of the largest rectangle in <matrix>.<br>The area of a rectangle is defined by number of 1's that it contains.<br>Again, you MUST make use of the helper <largest_at_position> here. If you<br>managed to code <largest_at_position> correctly, this function should be<br>simple to implement.<br>Similarly, do not modify (i.e., mutate) the input matrix.<br>Precondition:<br><matrix> will only contain the integers 1 and 0.<br>>>> case1 = [[1, 0, 1, 0, 0],<br>[1, 0, 1, 1, 1],<br>[1, 1, 1, 1, 1],<br>[1, 0, 0, 1, 0]]<br>>>> largest_in_matrix(case1)<br>pass<br>

Extracted text: def largest in_matrix(matrix: list[list[int]]) -> int: Returns the area of the largest rectangle in . The area of a rectangle is defined by number of 1's that it contains. Again, you MUST make use of the helper here. If you managed to code correctly, this function should be simple to implement. Similarly, do not modify (i.e., mutate) the input matrix. Precondition: will only contain the integers 1 and 0. >>> case1 = [[1, 0, 1, 0, 0], [1, 0, 1, 1, 1], [1, 1, 1, 1, 1], [1, 0, 0, 1, 0]] >>> largest_in_matrix(case1) pass

Jun 04, 2022
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here