Hello everybody. I think I have found a gap in the koltin stlib and I would like to make a contribution to it. But first I would like to discuss it with you to be sure it is worthwhile. A few days ago, a student asked me for help to find an efficient algorithm in kotlin to solve this exercise
https://www.hackerrank.com/challenges/fraudulent-activity-notifications/problem . After analyzing it, I realized that it is necessary to use a collection such that:
- it is mutable
- it has random/direct access (read-only)
- it keeps the elements sorted at all times (invariant)
- it can have duplicate elements
I started looking for data structures in the kotlin and java stlib and did not find any that met the requirements.
I searched stackoverflow and found this thread
https://stackoverflow.com/questions/8725387/why-is-there-no-sortedlist-in-java. None of the alternatives work to solve the exercise efficiently.
So I implemented the data structure myself and solved the exercise.
Personally I think it is worthwile because the hackerrank problem seems to me to be a likely scenario in the fintech domain.
What do you think?