Decrease runtime by increasing cache size.
All checks were successful
Solve / example-action (push) Successful in 3m16s
All checks were successful
Solve / example-action (push) Successful in 3m16s
This commit is contained in:
parent
5fd63ac62f
commit
aef2dc6159
@ -26,7 +26,7 @@ class PriorityCache<K, V>(private val maxSize: Int) {
|
|||||||
return cache.containsKey(key)
|
return cache.containsKey(key)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
val priorityCache = PriorityCache<String, Long>(20000)
|
val priorityCache = PriorityCache<String, Long>(50000)
|
||||||
fun getStonesAfter(input: List<Long>,iterations: Int, cache: PriorityCache<String, Long>): Long {
|
fun getStonesAfter(input: List<Long>,iterations: Int, cache: PriorityCache<String, Long>): Long {
|
||||||
var sum = 0L
|
var sum = 0L
|
||||||
for (i in input) {
|
for (i in input) {
|
||||||
|
Loading…
Reference in New Issue
Block a user