Attempting the Summer of bitcoin problem using python Attempt 1 is a very naive solution to the problem.
I figured that the problem could have been solved using topological sorting (DFS) and then storing parent-child chain in maps and then using the 0 1 knapsack like approach to the problem but because of the time constraint I am explaining it here.