def large_position(matrix: list[list[int]], row: int, col: int) -> int: """ Returns the area of the largest rectangle whose top left corner is at position , in . You MUST make use of the helper here as you loop through each row of the matrix. Do not modify (i.e., mutate) the input matrix. >>> case = [[1, 0, 1, 0, 0], ... [1, 0, 1, 1, 1], ... [1, 1, 1, 1, 1], ... [1, 0, 0, 1, 0]] >>> large_position(case1, 0, 0) 4 """ You must refer to this while writing for the code above Helper: def longest_chain(lst: List[int]) -> int: count = 0 i = 0 while (i < len(lst) and lst[i] != 0): i += 1 count += 1 return count """ Please do this on python you should not use any of the following: dictionaries or dictionary methods try-except break and continue statements recursion map / filter import ""'
def large_position(matrix: list[list[int]], row: int, col: int) -> int:
"""
Returns the area of the largest rectangle whose top left corner is at
position <row>, <col> in <matrix>.
You MUST make use of the helper <longest_chain> here as you loop through
each row of the matrix. Do not modify (i.e., mutate) the input matrix.
>>> case = [[1, 0, 1, 0, 0],
... [1, 0, 1, 1, 1],
... [1, 1, 1, 1, 1],
... [1, 0, 0, 1, 0]]
>>> large_position(case1, 0, 0)
4
"""
You must refer to this while writing for the code above Helper:
def longest_chain(lst: List[int]) -> int:
count = 0
i = 0
while (i < len(lst) and lst[i] != 0):
i += 1
count += 1
return count
""" Please do this on python
you should not use any of the following:
- dictionaries or dictionary methods
- try-except
- break and continue statements
- recursion
- map / filter
- import ""'
Trending now
This is a popular solution!
Step by step
Solved in 3 steps with 3 images