Skip to content

Instantly share code, notes, and snippets.

class Pokemon
# from here until line 9, we are INSIDE the class
# when a Pokemon is created, its name, type, and level must be set
def initialize(name, type, level)
@name = name
@type = type
@level = level
end
end
class Pokemon
# from here until line 9, we are INSIDE the class
attr_accessor :name, :type, :level
# when a Pokemon is created, its name, type, and level must be set
def initialize(name, type, level)
@name = name
@type = type
@level = level
end
class LinkedListNode
attr_accessor :value, :next
def initialize(value)
@value = value
@next = nil
end
def kth_to_last_node(k, head)