monkeyTrouble
We have two monkeys, a and b, and the parameters aSmile and bSmile indicate if each is smiling. We are in trouble if they are both smiling or if neither of them is smiling. Return true if we are in trouble.
Examples
monkeyTrouble(true, true) → true
monkeyTrouble(false, false) → true
monkeyTrouble(true, false) → false
Starter code
function monkeyTrouble(aSmile, bSmile) {
}
Complexity of the optimal solution
Time O(1), space O(1). The solution is a simple boolean expression. The time to evaluate it is constant and does not depend on the input. It uses a fixed amount of memory.