Skip to content

Instantly share code, notes, and snippets.

@luctus
Last active July 24, 2019 19:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save luctus/a9d4e87aa5c1306bbd31f1baa06b170e to your computer and use it in GitHub Desktop.
Save luctus/a9d4e87aa5c1306bbd31f1baa06b170e to your computer and use it in GitHub Desktop.
Technical interview for a backend developer
#########################################
# Excercise 1: Words Count
Phrase.new("one fish two fish red fish blue fish").count
# => {"one"=>1, "fish"=>4, "two"=>1, "red"=>1, "blue"=>1}
#########################################
# Excercise 2: Acronyms
Acronym.call("hello, how are you?")
# => "H.H.A.Y"
#########################################
# Excercise 3: School grades
# Given students' names along with the grade that they are in, create a roster for the school.
# In the end, you should be able to:
# - Add a student's name to the roster for a grade
# - "Add Jim to grade 2."
# - Get a list of all students enrolled in a grade
# - "Which students are in grade 2?"
# - Get a sorted list of all students in all grades. Grades should sort as 1, 2, 3, etc., and students within a grade should be sorted alphabetically by name.
# - "Who all is enrolled in school right now?"
# - "Grade 1: Anna, Barb, and Charlie."
# - "Grade 2: Alex, Peter, and Zoe."
# - ...
class School
def initialize
@grades = {}
end
def add(name, grade_num)
end
def students(grade_num)
end
def students_by_grade
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment