Algorithm · Hubspot · Medium
Problem You are given a mathematical expression encoded as a JSON object representing a binary expression tree. Your task is to compute and return the integer result of evaluating this tree. The tree follows two node shapes: Constant node – the operation field is "CONSTANT_NUMBER" and the node has a value field containing an integer. Operator node – the operation field is one of "ADD", "SUBTRACT", "MULTIPLY", or "DIVIDE". The node also contains an inputs list holding exactly…
Checking your access…