Created
April 22, 2016 21:48
-
-
Save slota/fc81f70b0073bc36bca69855762dece6 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'pry' | |
class Deque | |
attr_reader :array | |
def initialize | |
@array = [] | |
end | |
def push(var) | |
@array << var | |
end | |
def pop | |
@array.pop | |
end | |
def shift | |
@array.shift | |
end | |
def unshift(var) | |
@array << var | |
@array.reverse! | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment