There is a database of users and their hats at './database.json'.
- Find the total sum of the top-3 most selling hats. You can use lodash/underscore (recommended)
- What is the complexity in O() notation of time and space? Complete the comment with the right answer.
IMPORTANT: Find a balance between performance and legibility.
Imagine the following (taken from the real database):
Hat(7adbc650-2a5e-4e59-b88f-97377e0b7e34) sold 7.
Hat(872f5fc4-515f-416d-9ec6-3488da2bd74a) sold 6.
Hat(048d8fbf-7653-461f-a59c-68c73b8855e5) sold 7.
Hat(32266d28-5092-4a69-afb3-90fafd46e04a) sold 9.
-> Expected result: 9 + 7 + 7 => 23