id/email
password
forgot password | create account
about | help | code help+videos | done | prefs
CodingBat code practice

 

tmhscs@gmail.com stacks > stack_popStack
prev  |  next  |  chance

Given a Stack of integers, pop the top element off of the stack and return the stack. If the stack has no elements, return an empty stack.

YOUR FIRST TWO LINES OF CODE MUST BE:
Stack<Integer> stack = new Stack<Integer>();
stack.addAll(list);

stack_popStack([1, 2, 3, 4, 5]) → [1, 2, 3, 4]
stack_popStack([1, 2, 3]) → [1, 2]
stack_popStack([1]) → []

...Save, Compile, Run (ctrl-enter)

public Stack<Integer> stack_popStack(List<Integer> list) { }

Editor font size %:
Shorter output


Forget It! -- delete my code for this problem

Progress graphs:
 Your progress graph for this problem
 Random user progress graph for this problem
 Random Epic Progress Graph

Java Help

Misc Code Practice

Post-solution available

Copyright Nick Parlante 2017 - privacy