Challenge: Sort People with Sorter Interface
This lesson brings you a challenge to solve.
We'll cover the following
Problem statement
Define a struct Person
with firstName
and LastName
, and a type Persons
as a [ ]Person
. Implement the Sorter
interface for Persons
and test it. Implement the Sorter
interface in the file mysort.go in mysort folder, and Person
in main.go.
Try to attempt the challenge below. Feel free to view the solution, after giving some shots. Good Luck!
Get hands-on with 1400+ tech skills courses.