


def 	__lowerCamelCase						(							lowerCamelCase__		:						int  ,							lowerCamelCase__		:						int  ,							lowerCamelCase__		:						list[list[int]]      ):





			'''simple docstring'''




			def update_area_of_max_square(lowerCamelCase__		:						int  ,							lowerCamelCase__		:						int      ) -> int:
						# BASE CASE
						if row >= rows or col >= cols:
									return 0

						lowerCamelCase    		=  update_area_of_max_square(lowerCamelCase__  ,							col + 1      )
						lowerCamelCase    		=  update_area_of_max_square(row + 1  ,							col + 1      )
						lowerCamelCase    		=  update_area_of_max_square(row + 1  ,							lowerCamelCase__      )

						if mat[row][col]:
									lowerCamelCase    		=  1 + min([right, diagonal, down]      )
									lowerCamelCase    		=  max(largest_square_area[0]  ,							lowerCamelCase__      )
									return sub_problem_sol
						else:
									return 0

			lowerCamelCase    		=  [0]
			update_area_of_max_square(0  ,							0      )
			return largest_square_area[0]






def 	__lowerCamelCase						(							lowerCamelCase__		:						int  ,							lowerCamelCase__		:						int  ,							lowerCamelCase__		:						list[list[int]]      ):





			'''simple docstring'''




			def update_area_of_max_square_using_dp_array(
			    lowerCamelCase__		:						int  ,							lowerCamelCase__		:						int  ,							lowerCamelCase__		:						list[list[int]]      ) -> int:
						if row >= rows or col >= cols:
									return 0
						if dp_array[row][col] != -1:
									return dp_array[row][col]

						lowerCamelCase    		=  update_area_of_max_square_using_dp_array(lowerCamelCase__  ,							col + 1  ,							lowerCamelCase__      )
						lowerCamelCase    		=  update_area_of_max_square_using_dp_array(row + 1  ,							col + 1  ,							lowerCamelCase__      )
						lowerCamelCase    		=  update_area_of_max_square_using_dp_array(row + 1  ,							lowerCamelCase__  ,							lowerCamelCase__      )

						if mat[row][col]:
									lowerCamelCase    		=  1 + min([right, diagonal, down]      )
									lowerCamelCase    		=  max(largest_square_area[0]  ,							lowerCamelCase__      )
									lowerCamelCase    		=  sub_problem_sol
									return sub_problem_sol
						else:
									return 0

			lowerCamelCase    		=  [0]
			lowerCamelCase    		=  [[-1] * cols for _ in range(lowerCamelCase__      )]
			update_area_of_max_square_using_dp_array(0  ,							0  ,							lowerCamelCase__      )

			return largest_square_area[0]






def 	__lowerCamelCase						(							lowerCamelCase__		:						int  ,							lowerCamelCase__		:						int  ,							lowerCamelCase__		:						list[list[int]]      ):





			'''simple docstring'''




			lowerCamelCase    		=  [[0] * (cols + 1) for _ in range(rows + 1      )]
			lowerCamelCase    		=  0
			for row in range(rows - 1  ,							-1  ,							-1      ):
						for col in range(cols - 1  ,							-1  ,							-1      ):
									lowerCamelCase    		=  dp_array[row][col + 1]
									lowerCamelCase    		=  dp_array[row + 1][col + 1]
									lowerCamelCase    		=  dp_array[row + 1][col]

									if mat[row][col] == 1:
												lowerCamelCase    		=  1 + min(lowerCamelCase__  ,							lowerCamelCase__  ,							lowerCamelCase__      )
												lowerCamelCase    		=  max(dp_array[row][col]  ,							lowerCamelCase__      )
									else:
												lowerCamelCase    		=  0

			return largest_square_area






def 	__lowerCamelCase						(							lowerCamelCase__		:						int  ,							lowerCamelCase__		:						int  ,							lowerCamelCase__		:						list[list[int]]      ):





			'''simple docstring'''




			lowerCamelCase    		=  [0] * (cols + 1)
			lowerCamelCase    		=  [0] * (cols + 1)
			lowerCamelCase    		=  0
			for row in range(rows - 1  ,							-1  ,							-1      ):
						for col in range(cols - 1  ,							-1  ,							-1      ):
									lowerCamelCase    		=  current_row[col + 1]
									lowerCamelCase    		=  next_row[col + 1]
									lowerCamelCase    		=  next_row[col]

									if mat[row][col] == 1:
												lowerCamelCase    		=  1 + min(lowerCamelCase__  ,							lowerCamelCase__  ,							lowerCamelCase__      )
												lowerCamelCase    		=  max(current_row[col]  ,							lowerCamelCase__      )
									else:
												lowerCamelCase    		=  0
						lowerCamelCase    		=  current_row

			return largest_square_area


if __name__ == "__main__":
		import doctest

		doctest.testmod()
		print(largest_square_area_in_matrix_bottom_up(2, 2, [[1, 1], [1, 1]]))





from ..utils import DummyObject, requires_backends







class        __lowercase       (							metaclass=a_  ):



		"""simple docstring"""

		UpperCamelCase     :					Tuple			       =		["flax"]







		def __init__( self		,      *A		,      **A	)  -> str:







					'''simple docstring'''







					requires_backends(self		,      ["""flax"""]	)







		@classmethod
		def 					__A   ( cls		,      *A		,      **A	)  -> int:







					'''simple docstring'''







					requires_backends(cls		,      ["""flax"""]	)







		@classmethod
		def 					__A   ( cls		,      *A		,      **A	)  -> str:







					'''simple docstring'''







					requires_backends(cls		,      ["""flax"""]	)







class        __lowercase       (							metaclass=a_  ):



		"""simple docstring"""

		UpperCamelCase     :					Optional[Any]			       =		["flax"]







		def __init__( self		,      *A		,      **A	)  -> Dict:







					'''simple docstring'''







					requires_backends(self		,      ["""flax"""]	)







		@classmethod
		def 					__A   ( cls		,      *A		,      **A	)  -> List[str]:







					'''simple docstring'''







					requires_backends(cls		,      ["""flax"""]	)







		@classmethod
		def 					__A   ( cls		,      *A		,      **A	)  -> Dict:







					'''simple docstring'''







					requires_backends(cls		,      ["""flax"""]	)







class        __lowercase       (							metaclass=a_  ):



		"""simple docstring"""

		UpperCamelCase     :					str			       =		["flax"]







		def __init__( self		,      *A		,      **A	)  -> Dict:







					'''simple docstring'''







					requires_backends(self		,      ["""flax"""]	)







		@classmethod
		def 					__A   ( cls		,      *A		,      **A	)  -> Union[str, Any]:







					'''simple docstring'''







					requires_backends(cls		,      ["""flax"""]	)







		@classmethod
		def 					__A   ( cls		,      *A		,      **A	)  -> Optional[int]:







					'''simple docstring'''







					requires_backends(cls		,      ["""flax"""]	)







class        __lowercase       (							metaclass=a_  ):



		"""simple docstring"""

		UpperCamelCase     :					str			       =		["flax"]







		def __init__( self		,      *A		,      **A	)  -> List[Any]:







					'''simple docstring'''







					requires_backends(self		,      ["""flax"""]	)







		@classmethod
		def 					__A   ( cls		,      *A		,      **A	)  -> Any:







					'''simple docstring'''







					requires_backends(cls		,      ["""flax"""]	)







		@classmethod
		def 					__A   ( cls		,      *A		,      **A	)  -> Union[str, Any]:







					'''simple docstring'''







					requires_backends(cls		,      ["""flax"""]	)







class        __lowercase       (							metaclass=a_  ):



		"""simple docstring"""

		UpperCamelCase     :					Dict			       =		["flax"]







		def __init__( self		,      *A		,      **A	)  -> Optional[Any]:







					'''simple docstring'''







					requires_backends(self		,      ["""flax"""]	)







		@classmethod
		def 					__A   ( cls		,      *A		,      **A	)  -> Optional[Any]:







					'''simple docstring'''







					requires_backends(cls		,      ["""flax"""]	)







		@classmethod
		def 					__A   ( cls		,      *A		,      **A	)  -> Any:







					'''simple docstring'''







					requires_backends(cls		,      ["""flax"""]	)







class        __lowercase       (							metaclass=a_  ):



		"""simple docstring"""

		UpperCamelCase     :					Optional[int]			       =		["flax"]







		def __init__( self		,      *A		,      **A	)  -> int:







					'''simple docstring'''







					requires_backends(self		,      ["""flax"""]	)







		@classmethod
		def 					__A   ( cls		,      *A		,      **A	)  -> int:







					'''simple docstring'''







					requires_backends(cls		,      ["""flax"""]	)







		@classmethod
		def 					__A   ( cls		,      *A		,      **A	)  -> str:







					'''simple docstring'''







					requires_backends(cls		,      ["""flax"""]	)







class        __lowercase       (							metaclass=a_  ):



		"""simple docstring"""

		UpperCamelCase     :					Union[str, Any]			       =		["flax"]







		def __init__( self		,      *A		,      **A	)  -> List[Any]:







					'''simple docstring'''







					requires_backends(self		,      ["""flax"""]	)







		@classmethod
		def 					__A   ( cls		,      *A		,      **A	)  -> Tuple:







					'''simple docstring'''







					requires_backends(cls		,      ["""flax"""]	)







		@classmethod
		def 					__A   ( cls		,      *A		,      **A	)  -> Optional[int]:







					'''simple docstring'''







					requires_backends(cls		,      ["""flax"""]	)







class        __lowercase       (							metaclass=a_  ):



		"""simple docstring"""

		UpperCamelCase     :					Optional[Any]			       =		["flax"]







		def __init__( self		,      *A		,      **A	)  -> Optional[Any]:







					'''simple docstring'''







					requires_backends(self		,      ["""flax"""]	)







		@classmethod
		def 					__A   ( cls		,      *A		,      **A	)  -> int:







					'''simple docstring'''







					requires_backends(cls		,      ["""flax"""]	)







		@classmethod
		def 					__A   ( cls		,      *A		,      **A	)  -> int:







					'''simple docstring'''







					requires_backends(cls		,      ["""flax"""]	)







class        __lowercase       (							metaclass=a_  ):



		"""simple docstring"""

		UpperCamelCase     :					Tuple			       =		["flax"]







		def __init__( self		,      *A		,      **A	)  -> str:







					'''simple docstring'''







					requires_backends(self		,      ["""flax"""]	)







		@classmethod
		def 					__A   ( cls		,      *A		,      **A	)  -> List[Any]:







					'''simple docstring'''







					requires_backends(cls		,      ["""flax"""]	)







		@classmethod
		def 					__A   ( cls		,      *A		,      **A	)  -> str:







					'''simple docstring'''







					requires_backends(cls		,      ["""flax"""]	)







class        __lowercase       (							metaclass=a_  ):



		"""simple docstring"""

		UpperCamelCase     :					Any			       =		["flax"]







		def __init__( self		,      *A		,      **A	)  -> List[str]:







					'''simple docstring'''







					requires_backends(self		,      ["""flax"""]	)







		@classmethod
		def 					__A   ( cls		,      *A		,      **A	)  -> int:







					'''simple docstring'''







					requires_backends(cls		,      ["""flax"""]	)







		@classmethod
		def 					__A   ( cls		,      *A		,      **A	)  -> str:







					'''simple docstring'''







					requires_backends(cls		,      ["""flax"""]	)







class        __lowercase       (							metaclass=a_  ):



		"""simple docstring"""

		UpperCamelCase     :					str			       =		["flax"]







		def __init__( self		,      *A		,      **A	)  -> Dict:







					'''simple docstring'''







					requires_backends(self		,      ["""flax"""]	)







		@classmethod
		def 					__A   ( cls		,      *A		,      **A	)  -> Optional[int]:







					'''simple docstring'''







					requires_backends(cls		,      ["""flax"""]	)







		@classmethod
		def 					__A   ( cls		,      *A		,      **A	)  -> Dict:







					'''simple docstring'''







					requires_backends(cls		,      ["""flax"""]	)







class        __lowercase       (							metaclass=a_  ):



		"""simple docstring"""

		UpperCamelCase     :					Optional[int]			       =		["flax"]







		def __init__( self		,      *A		,      **A	)  -> List[str]:







					'''simple docstring'''







					requires_backends(self		,      ["""flax"""]	)







		@classmethod
		def 					__A   ( cls		,      *A		,      **A	)  -> Any:







					'''simple docstring'''







					requires_backends(cls		,      ["""flax"""]	)







		@classmethod
		def 					__A   ( cls		,      *A		,      **A	)  -> Any:







					'''simple docstring'''







					requires_backends(cls		,      ["""flax"""]	)







class        __lowercase       (							metaclass=a_  ):



		"""simple docstring"""

		UpperCamelCase     :					Tuple			       =		["flax"]







		def __init__( self		,      *A		,      **A	)  -> str:







					'''simple docstring'''







					requires_backends(self		,      ["""flax"""]	)







		@classmethod
		def 					__A   ( cls		,      *A		,      **A	)  -> Dict:







					'''simple docstring'''







					requires_backends(cls		,      ["""flax"""]	)







		@classmethod
		def 					__A   ( cls		,      *A		,      **A	)  -> Union[str, Any]:







					'''simple docstring'''







					requires_backends(cls		,      ["""flax"""]	)

