Skip to content

Commit 0d78d31

Browse files
committed
Refactor Y2024D09.
Private modifier, remove return.
1 parent f2589a3 commit 0d78d31

File tree

1 file changed

+3
-8
lines changed

1 file changed

+3
-8
lines changed

Diff for: solutions/aockt/y2024/Y2024D09.kt

+3-8
Original file line numberDiff line numberDiff line change
@@ -81,18 +81,13 @@ object Y2024D09 : Solution {
8181
.takeIf { it != -1 }
8282
?.let { start + it }
8383

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
84+
/** If the last page uses more than one block, split the last block in its own page. */
85+
private fun fragmentLast() {
86+
if (data.last().used <= 1) return
9087

9188
val page = data.removeLast()
9289
data.addLast(page.copy(used = page.used - 1, free = 0))
9390
data.addLast(page.copy(used = 1, free = page.free))
94-
95-
return true
9691
}
9792

9893
/** Moves the [source] page into the free space of the [destination] page. */

0 commit comments

Comments
 (0)