As reported: Wells Fargo Early Careers Global Technology internship assessment (HackerRank, three questions in 60 minutes; 2026). The programming question, done in an IDE, asked to implement
StudentandCourseclasses with simple functions such asget_students,get_coursesanddisenroll.
Implement two classes:
Course(name)get_students()— the names of the students currently enrolled, in the order they enrolled.
Student(name)enroll(course)— enroll the student in the course. Returnstrue, orfalseif the student is already enrolled in it.disenroll(course)— remove the enrollment. Returnstrue, orfalseif the student was not enrolled in it.get_courses()— the names of the student's current courses, in the order they were enrolled.
The two views must always agree: after alice.enroll(math), math.get_students() contains alice and alice.get_courses() contains math; after disenroll neither does. Enrolling again after a disenroll puts the course at the end of the order.
In Java, C++, JavaScript and Go the methods are getStudents, getCourses, enroll, disenroll (Go: GetStudents, GetCourses, Enroll, Disenroll, with constructors NewStudent(name) and NewCourse(name)).
Example
ops: enroll(alice, math) enroll(bob, math) enroll(alice, art) enroll(alice, math)
result: true true true false
ops: get_students(math) disenroll(alice, math) get_courses(alice) get_students(math)
result: ["alice","bob"] true ["art"] ["bob"]
Code runner format: one line holding a JSON list of operations: ["enroll", student, course], ["disenroll", student, course], ["get_courses", student], ["get_students", course]. The harness creates each Student and Course the first time its name appears, calls your methods, and prints the list of results as JSON. Open Practice for the class skeletons in all five languages.