Implement the function is_unique_binary_tree_possible in a file called /app/solution.py. This function will determine whether a unique binary tree can be constructed from two given traversal types.
Functionality:
The function should assess the two traversal types provided as integers and return a boolean value indicating if a unique binary tree can be formed.
Input Requirements:
The function accepts two parameters:
a (int): Represents the first traversal type. It can take one of the following values:
1: Preorder
2: Inorder
3: Postorder
b (int): Represents the second traversal type, with the same possible values as a.
Output Requirements:
The function should return a boolean value:
True: If a unique binary tree can be constructed from the given traversal types.
False: If a unique binary tree cannot be constructed.
Constraints:
The function should return True if:
At least one of the traversal types is "inorder" (denoted by 2).
Both traversal types are not "inorder" (i.e., it is not the case that both a and b are 2).