Design a stack that supports push, pop, top, and retrieving the minimum element in constant time and using constant extra space.
{
"operations": [
"push",
"push",
"push",
"getMin",
"pop",
"top",
"getMin"
],
"values": [
-2,
0,
-3
]
}[
-3,
0,
-2
]{
"operations": [
"push",
"getMin",
"pop",
"getMin"
],
"values": [
0
]
}[
0,
-1
]{
"operations": [
"push",
"push",
"getMin",
"push",
"getMin"
],
"values": [
2147483646,
2147483646,
2147483647
]
}[
2147483646,
2147483646
]Sign in to Run Code and Submit