Company: Zscalar_16nov
Difficulty: medium
Evaluating Circuit Expressions Problem Description A circuit expression consists of the following symbols: - [ denotes operation precedence - & denotes the logical AND operation - | denotes the logical OR operation - ! denotes the logical NOT operation - 1 denotes logical true - 0 denotes logical false The task is to evaluate a given circuit expression and find its logical value, which is either 1 (logical true) or 0 (logical false). Complete the function circuitsOutput in the editor with the following parameter(s): string circuitExpression[q]: a list of logical expressions Returns int[q]: the logical result of the logical expressions, either 1 or 0 Input Format For Custom Testing The first line contains an integer, q, the number of expressions. Each of the following q lines contains a string, circuitExpression[i]. Examples Example 1: Input: 1 [&, [!, 0], [|, [!, 1], [0], [1]]] Output: 1 Explanation: Evaluate the expression in each step: 1. [&, [!, 0], [|, [!, 1], [0], [1]]] -> [&, [1]