Path of Building终极指南:三步打造流放之路完美角色构筑
2026/4/24 13:03:17
Stack<Integer>stack1=newStack<Integer>();Stack<Integer>stack2=newStack<Integer>();publicvoidpush(intnode){stack1.push(node);}publicintpop(){if(stack2.isEmpty()){while(!stack1.isEmpty()){stack2.push(stack1.pop());}}returnstack2.pop();}stack1stack1只管入队,stack2只管出队,并且只有当stack2为空时才进行一次性倒栈