In computer science, a stack is a particular kind of data type or collection in which the principal operations in the collection are the addition of an entity to the collection (also known as push) and the removal of an entity (also known as pop). The relation between the push and pop operations is such that the stack is a Last-In-First-Out (LIFO) data structure. In a LIFO data structure, the last element added to the structure must be the first one to be removed. Often a peek, or top operation is also implemented, returning the value of the top element without removing it.
We will emulate the stack process with Python. You are given a sequence of commands:
- "PUSH X" -- add X in the stack, where X is a digit.
- "POP" -- look and remove the top position. If the stack is empty, then it returns 0 (zero) and does nothing.
- "PEEK" -- look at the top position. If the stack is empty, then it returns 0 (zero).
The stack can only contain digits.
You should process all commands and sum all digits which...
- No Ads
- No Limits
- More Content
CheckiO Extensions allow you to use local files to solve missions. More info in a blog post.
In order to install CheckiO client you'll need installed Python (version at least 3.8)
Install CheckiO Client first:
pip3 install checkio_client
Configure your tool
checkio --domain=py config --key=
Sync solutions into your local folder
(in beta testing) Launch local server so your browser can use it and sync solution between local file end extension on the fly. (doesn't work for safari)
checkio serv -d
Alternatevly, you can install Chrome extension or FF addon
checkio install-plugin --ff
checkio install-plugin --chromium