Solución
solution.tsTypeScript
public class Solution {
public boolean logicGate(boolean firstValue, boolean secondValue, String gate) {
switch (gate.toUpperCase()){
case "AND" -> {
return firstValue && secondValue;
}
case "OR" -> {
return firstValue || secondValue;
}
case "XOR" -> {
return !(firstValue || secondValue);
}
case "NAND" -> {
return !(firstValue && secondValue);
}
}
return false;
}
}0respuestas