complete 12015.kt 12738.kt 14626.kt 33985.kt 34029.kt 34060.kt 9252.py

This commit is contained in:
2025-07-13 16:13:49 +09:00
parent cd64086305
commit 7e42a7b447
7 changed files with 253 additions and 0 deletions

View File

@@ -0,0 +1,28 @@
fun getLengthLIS(arr: List<Int>): Int {
val lisProps = mutableListOf<Int>()
arr.forEach {
val x = lisProps.binarySearch(it).let { it ->
if (it < 0) {
-(it + 1)
} else {
it
}
}
if (x == lisProps.size) {
lisProps.add(it)
} else {
lisProps[x] = it
}
}
return lisProps.size
}
fun main() {
readln()
val arr = readln().split(' ').map { it.toInt() }
println(getLengthLIS(arr))
}