I added spoiler tags since your solution works.
I think that your solution is basically the approach used in the second solution on the hints page: freeCodeCamp Challenge Guide: Where do I Belong
I added spoiler tags since your solution works.
I think that your solution is basically the approach used in the second solution on the hints page: freeCodeCamp Challenge Guide: Where do I Belong