human
Find two Fibonacci numbers whose sum can be represented as N | Function to create hash table to check Fibonacci numbers.
Storing the first two numbers in the hash.
Finding Fibonacci numbers up to N and storing them in the hash.
Function to find the Fibonacci pair with the given sum.
creating a set containing all fibonacci numbers.
Traversing all numbers to find first pair.
If both i and ( N - i ) are Fibonacci.
Printing the pair because i + ( N - i ) = N.
If no fibonacci pair is found whose sum is equal to n.
Driven code"
Solution in Python:
 ... Write me a code to find two Fibonacci numbers whose sum can be represented as N and the other steps required?
assistant
#Here is code to find two Fibonacci numbers whose sum can be represented as N and the other steps required.
 def createHash ( hash1 , maxElement ) :
	prev , curr = 0 , 1
	hash1 . add ( prev )
	hash1 . add ( curr )
	while ( curr < maxElement ) :
		temp = curr + prev
		hash1 . add ( temp )
		prev = curr
		curr = temp
def findFibonacciPair ( n ) :
	hash1 = set ( )
	createHash ( hash1 , n )
	for i in range ( n ) :
		if ( i in hash1 and ( n - i ) in hash1 ) :
			print ( i , " , ▁ " , ( n - i ) )
			return
	print ( " - 1" )
if __name__ == " _ _ main _ _ " :
	N = 90
	findFibonacciPair ( N )