Skip to content

Commit 0f709be

Browse files
committed
Programmers.kt modified :
1. acc.plus(size) => intArrayOf(size).plus(acc), 2. prog.isEmpty() -> acc => acc.reversed().toIntArray()
1 parent ff3ca93 commit 0f709be

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

kotlin/src/main/kotlin/Programmers.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,11 @@ fun main(args: Array<String>) {
2525
각 배포마다 몇 개의 기능이 배포되는지를 return 하도록 solution 함수를 완성하세요.
2626
*/
2727
tailrec fun solve(prog: IntArray, spd: IntArray, acc: IntArray = intArrayOf()): IntArray = when {
28-
prog.isEmpty() -> acc
28+
prog.isEmpty() -> acc.reversed().toIntArray()
2929
prog.first() >= 100 -> {
3030
val temp = prog.takeWhile { it >= 100 }
3131
val size = temp.size
32-
solve(prog.drop(size).toIntArray(), spd.drop(size).toIntArray(), acc.plus(size))
32+
solve(prog.drop(size).toIntArray(), spd.drop(size).toIntArray(), intArrayOf(size).plus(acc))
3333
}
3434
else -> {
3535
val temp = zipping(prog, spd)

0 commit comments

Comments
 (0)