Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function solve(input) {
- let print = [];
- for(let i = 1; i <= input.length; i ++){
- input[i - 1] === "add" ? print.push(i) : print.pop();
- }
- console.log(print.length > 0 ? print.join(" ") : "Empty");
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement