human
Check if N can be represented as sum of integers chosen from set { A , B } | Function to find if number N can be represented as sum of a ' s ▁ and ▁ b ' s.
base condition.
If x is already visited.
Set x as possible.
Recursive call.
Driver Code"
Solution in Python:
 Give me a code to check if N can be represented as sum of integers chosen from set { A , B } and the other steps required?
assistant
#Here is code to check if N can be represented as sum of integers chosen from set { A , B } and the other steps required.
 def checkIfPossibleRec ( x , a , b , isPossible , n ) :
	if x > n :
		return
	if isPossible [ x ] :
		return
	isPossible [ x ] = True
	checkIfPossibleRec ( x + a , a , b , isPossible , n )
	checkIfPossibleRec ( x + b , a , b , isPossible , n )
def checkPossible ( n , a , b ) :
	isPossible = [ False ] * ( n + 1 )
	checkIfPossibleRec ( 0 , a , b , isPossible , n )
	return isPossible [ n ]
if __name__ == " _ _ main _ _ " :
	a , b , n = 3 , 7 , 8
	if checkPossible ( a , b , n ) :
		print ( " Yes " )
	else :
		print ( " No " )