If you are going to do this similarly to the way way I do it below, you will need to understand these concepts.
- Array instance reduce() parameters and reduce() in general
- Array instance sort() parameters and sort() in general
Simply remembering the code will only take you so far. You may be asked to explain. It is a lot easier to remember something and explain it if you understand it. Memorizing might get you through a phone screen but not live coding.