This is a clean-up version of the Scala solution of the team Starmind Scala to the Hash Code 2020 challenge from Google.
The details of the challenge, including the datasets, can be found in the challenge folder.
This solution achieved 26,929,308 points, putting us at position 194 in the ranking, with more than 10,000 teams participating.
The team consisted of Starmind employees
- Stijn Vermeeren (stijnvermeeren)
- Nicu Reut (ecyshor)
- Felix Kieber (Foesec)
with additional support from
- Stefan Jacobs (stefanjacobs123)
Our solution is essentially a greedy search: whenever we can sign up another library, pick the one with the highest score, considering the books that will already be scanned anyway by previously selected libraries.
The score of a library is composed of...
- The maximum value that we can still get from the library (i.e. by signing it up immediately and scanning the books that are not already scanned from other libraries from highest value to lowest value).
- The number of days it takes to sign up this library (we essentially pick a library with maximal value per day of sign-up time).
The Scala code can be compiled and executed using sbt.
sbt "runMain challenge.Main"
The output will be written to the output directory.