forked from Cookies_Github_mirror/AquaDX
[F] Fix index out of bounds
This commit is contained in:
@@ -25,6 +25,7 @@ fun findTrend(log: List<TrendLog>): List<TrendOut> {
|
||||
|
||||
// O(n log n)
|
||||
val d = log.sortedBy { it.date }.toList()
|
||||
if (d.isEmpty()) return listOf()
|
||||
|
||||
// Precompute the play counts for each date in O(n)
|
||||
val playCounts = d.groupingBy { it.date }.eachCount()
|
||||
|
||||
Reference in New Issue
Block a user