Skip to content

Commit 845f1b9

Browse files
committed
feat: add solutions to lc problem: No.1440
No.1440.Evaluate Boolean Expression
1 parent ba975cb commit 845f1b9

File tree

3 files changed

+78
-2
lines changed

3 files changed

+78
-2
lines changed

solution/1400-1499/1440.Evaluate Boolean Expression/README.md

+26-1
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,32 @@ Result 表:
8686
### **SQL**
8787

8888
```sql
89-
89+
# Write your MySQL query statement below
90+
select
91+
left_operand,
92+
operator,
93+
right_operand,
94+
case
95+
when (
96+
(
97+
e.operator = '='
98+
and v1.value = v2.value
99+
)
100+
or (
101+
e.operator = '>'
102+
and v1.value > v2.value
103+
)
104+
or (
105+
e.operator = '<'
106+
and v1.value < v2.value
107+
)
108+
) then 'true'
109+
else 'false'
110+
end value
111+
from
112+
Expressions e
113+
left join Variables v1 on e.left_operand = v1.name
114+
left join Variables v2 on e.right_operand = v2.name
90115
```
91116

92117
<!-- tabs:end -->

solution/1400-1499/1440.Evaluate Boolean Expression/README_EN.md

+26-1
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,32 @@ As shown, you need to find the value of each boolean expression in the table usi
8888
### **SQL**
8989

9090
```sql
91-
91+
# Write your MySQL query statement below
92+
select
93+
left_operand,
94+
operator,
95+
right_operand,
96+
case
97+
when (
98+
(
99+
e.operator = '='
100+
and v1.value = v2.value
101+
)
102+
or (
103+
e.operator = '>'
104+
and v1.value > v2.value
105+
)
106+
or (
107+
e.operator = '<'
108+
and v1.value < v2.value
109+
)
110+
) then 'true'
111+
else 'false'
112+
end value
113+
from
114+
Expressions e
115+
left join Variables v1 on e.left_operand = v1.name
116+
left join Variables v2 on e.right_operand = v2.name
92117
```
93118

94119
<!-- tabs:end -->
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# Write your MySQL query statement below
2+
select
3+
left_operand,
4+
operator,
5+
right_operand,
6+
case
7+
when (
8+
(
9+
e.operator = '='
10+
and v1.value = v2.value
11+
)
12+
or (
13+
e.operator = '>'
14+
and v1.value > v2.value
15+
)
16+
or (
17+
e.operator = '<'
18+
and v1.value < v2.value
19+
)
20+
) then 'true'
21+
else 'false'
22+
end value
23+
from
24+
Expressions e
25+
left join Variables v1 on e.left_operand = v1.name
26+
left join Variables v2 on e.right_operand = v2.name

0 commit comments

Comments
 (0)