We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent f2589a3 commit 0d78d31Copy full SHA for 0d78d31
solutions/aockt/y2024/Y2024D09.kt
@@ -81,18 +81,13 @@ object Y2024D09 : Solution {
81
.takeIf { it != -1 }
82
?.let { start + it }
83
84
- /**
85
- * If the last page uses more than one block, split the last block in its own page.
86
- * Returns whether any modification took place.
87
- */
88
- fun fragmentLast(): Boolean {
89
- if (data.last().used <= 1) return false
+ /** If the last page uses more than one block, split the last block in its own page. */
+ private fun fragmentLast() {
+ if (data.last().used <= 1) return
90
91
val page = data.removeLast()
92
data.addLast(page.copy(used = page.used - 1, free = 0))
93
data.addLast(page.copy(used = 1, free = page.free))
94
-
95
- return true
96
}
97
98
/** Moves the [source] page into the free space of the [destination] page. */
0 commit comments