Morgan Stanley Interview Question
Software Engineer InternsCountry: India
Interview Type: Written Test
1. Search a tree recursively, returning the minimum and maximum nodes. This should be pretty straight-forward.
2. Turn your problem into a tree. I would basically have the root (for your example) be 1+2*3+4*5, and then brackets get added as you move down the tree; a child of the root, for instance, could be (1+2)*3+4*5.
If you solve both of those problems, you'll have a recursive solution to your original question.
1. Search a tree recursively, returning the minimum and maximum nodes. This should be pretty straight-forward.
- ArvindAaswani01 November 22, 20162. Turn your problem into a tree. I would basically have the root (for your example) be 1+2*3+4*5, and then brackets get added as you move down the tree; a child of the root, for instance, could be (1+2)*3+4*5.
If you solve both of those problems, you'll have a recursive solution to your original question.