Learn
Practice
Interview
Resources
Newsletter
F
Toggle theme
0
F
0
Toggle menu
Animations
← Back to All Animations
Baseball Game
Bookmark
Input
Standard
Complex
Simple
All Cancelled
Custom
operations
=
[5, 2, C, D, +]
0
1
2
3
4
5
2
C
D
+
stack
0
1
2
3
4
5
2
C
D
+
stack
0
1
2
3
4
5
2
C
D
+
stack
0
1
2
3
4
5
2
C
D
+
i
5
top
stack
push
5
onto the stack
0
1
2
3
4
5
2
C
D
+
i
5
top
stack
operations[1] =
"2"
record a new score
0
1
2
3
4
5
2
C
D
+
i
5
2
top
stack
operations[2] =
"C"
remove the last score
0
1
2
3
4
5
2
C
D
+
i
5
2
top
stack
pop
2
, the score from operations[1] is cancelled
0
1
2
3
4
5
2
C
D
+
i
5
10
top
stack
push 2 ×
5
=
10
0
1
2
3
4
5
2
C
D
+
i
5
10
top
stack
operations[4] =
"+"
sum the last two scores
0
1
2
3
4
5
2
C
D
+
5
10
15
top
stack
sum =
5 + 10 + 15
=
30
0
1
2
3
4
5
2
C
D
+
5
10
15
top
stack
return 30
, the total score
algo
master
.
io
Step:
Start of algorithm
0 / 13
Input
Standard
Complex
Simple
All Cancelled
Custom
operations
=
[5, 2, C, D, +]
0 / 13
algo
master
.
io
Step:
Start of algorithm