I was resolving a HackerRank quiz, which consisted in emulating a pagination request. The function received an array of items, the sort parameter, the sort order, the