





"""simple docstring"""




from __future__ import annotations





def 	a_    (							_lowercase       ):  # This function is recursive
						_UpperCamelCase      : str         =   len(_lowercase       )
						# If the array contains only one element, we return it (it's the stop condition of
						# recursion)
						if array_length <= 1:
												return array
												# Else
						_UpperCamelCase      : Any         =   array[0]
						_UpperCamelCase      : List[str]         =   False
						_UpperCamelCase      : Optional[int]         =   1
						_UpperCamelCase      : list[int]         =   []
						while not is_found and i < array_length:
												if array[i] < pivot:
																		_UpperCamelCase      : List[str]         =   True
																		_UpperCamelCase      : Optional[int]         =   [element for element in array[i:] if element >= array[i]]
																		_UpperCamelCase      : str         =   longest_subsequence(_lowercase       )
																		if len(_lowercase       ) > len(_lowercase       ):
																								_UpperCamelCase      : Optional[Any]         =   temp_array
												else:
																		i += 1

						_UpperCamelCase      : Union[str, Any]         =   [element for element in array[1:] if element >= pivot]
						_UpperCamelCase      : Tuple         =   [pivot, *longest_subsequence(_lowercase       )]
						if len(_lowercase       ) > len(_lowercase       ):
												return temp_array
						else:
												return longest_subseq


if __name__ == "__main__":
						import doctest

						doctest.testmod()










"""simple docstring"""




from functools import lru_cache





@lru_cache
def 	a_    (							_lowercase       ):
						if num < 0:
												raise ValueError('''Number should not be negative.'''       )

						return 1 if num in (0, 1) else num * factorial(num - 1       )


if __name__ == "__main__":
						import doctest

						doctest.testmod()



