Stack Generic
Execution time limit is 1 second
Runtime memory usage limit is 128 megabytes
Implement a generic Stack.
Implement interface Stackable<T>.
Implement class MyStack<T> based on Stack data structure that implements interface Stackable<T>.Java
interface Stackable<T> { void push(T value); // push element to the top of the stack T pop(); // remove and return element from the top of the stack T peek(); // return element from the top of the stack boolean Empty(); // check if stack is empty int size(); // return size of the stack } class MyStack<T> implements Stackable<T> { public Stack<T> s; ... }
C++
template <class T> class Stackable { public: void push(T value); T pop(); T peek(); bool Empty(); int size(); }; template <class T> class MyStack : public Stackable <T> { public: stack <T> s; };
Submissions 405
Acceptance rate 44%