Describe a time you solved a problem using trees and dynamic programming, and walk me through your approach.
Implement max_non_adjacent_tree(root). The input is a binary tree represented by nested dictionaries with value, left, and right keys, or None; return the maximum sum of node values where no selected node is directly connected to another selected node.
value and left and right keys.def max_non_adjacent_tree(root):