
def        UpperCamelCase    (							lowerCAmelCase__ ,			lowerCAmelCase__		):
					'''simple docstring'''
					lowercase							=						len(lowerCAmelCase__		)
					lowercase							=						[[False] * (required_sum + 1) for _ in range(arr_len + 1		)]

					# for each arr value, a sum of zero(0) can be formed by not taking any element
					# hence True/1
					for i in range(arr_len + 1		):
										lowercase							=						True

					# sum is not zero and set is empty then false
					for i in range(1 ,			required_sum + 1		):
										lowercase							=						False

					for i in range(1 ,			arr_len + 1		):
										for j in range(1 ,			required_sum + 1		):
															if arr[i - 1] > j:
																				lowercase							=						subset[i - 1][j]
															if arr[i - 1] <= j:
																				lowercase							=						subset[i - 1][j] or subset[i - 1][j - arr[i - 1]]

					return subset[arr_len][required_sum]


if __name__ == "__main__":
							import doctest

							doctest.testmod()








import unittest

from knapsack import knapsack as k





class   __a			(    unittest.TestCase      ):
 def 		SCREAMING_SNAKE_CASE__   (   self )					->				Tuple:




        '''simple docstring'''
        lowercase__:   List[Any]  			=   0
        lowercase__:   List[Any]  			=   [0]
        lowercase__:   str  			=   [0]
        lowercase__:   Tuple  			=   len(lowerCAmelCase__ )
        self.assertEqual(k.knapsack(lowerCAmelCase__				, lowerCAmelCase__				, lowerCAmelCase__				, lowerCAmelCase__ )				, 0 )

        lowercase__:   Optional[Any]  			=   [60]
        lowercase__:   Dict  			=   [10]
        lowercase__:   str  			=   len(lowerCAmelCase__ )
        self.assertEqual(k.knapsack(lowerCAmelCase__				, lowerCAmelCase__				, lowerCAmelCase__				, lowerCAmelCase__ )				, 0 )
 def 		SCREAMING_SNAKE_CASE__   (   self )					->				Union[str, Any]:




        '''simple docstring'''
        lowercase__:   Union[str, Any]  			=   3
        lowercase__:   List[str]  			=   [1, 2, 3]
        lowercase__:   Union[str, Any]  			=   [3, 2, 1]
        lowercase__:   Union[str, Any]  			=   len(lowerCAmelCase__ )
        self.assertEqual(k.knapsack(lowerCAmelCase__				, lowerCAmelCase__				, lowerCAmelCase__				, lowerCAmelCase__ )				, 5 )
 def 		SCREAMING_SNAKE_CASE__   (   self )					->				List[Any]:




        '''simple docstring'''
        lowercase__:   Optional[Any]  			=   50
        lowercase__:   str  			=   [60, 100, 120]
        lowercase__:   Any  			=   [10, 20, 30]
        lowercase__:   List[Any]  			=   len(lowerCAmelCase__ )
        self.assertEqual(k.knapsack(lowerCAmelCase__				, lowerCAmelCase__				, lowerCAmelCase__				, lowerCAmelCase__ )				, 220 )


if __name__ == "__main__":
 unittest.main()


