From 1d997a3ece15035b19f3e013ec0eaec901488fab Mon Sep 17 00:00:00 2001 From: Tomasz Polgrabia Date: Mon, 6 Jan 2025 12:22:23 +0100 Subject: [PATCH] Added implementation for 17.9 for kth multiples. Used Eratosthenes method which is less than desirable. --- .../pl/polgrabia/demos/crackingcodeinterview/t17x9/Program.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/2025/01/cracking_code_interview_17_9_kth_multiple/src/main/kotlin/pl/polgrabia/demos/crackingcodeinterview/t17x9/Program.kt b/2025/01/cracking_code_interview_17_9_kth_multiple/src/main/kotlin/pl/polgrabia/demos/crackingcodeinterview/t17x9/Program.kt index a9e12bc..c60b517 100644 --- a/2025/01/cracking_code_interview_17_9_kth_multiple/src/main/kotlin/pl/polgrabia/demos/crackingcodeinterview/t17x9/Program.kt +++ b/2025/01/cracking_code_interview_17_9_kth_multiple/src/main/kotlin/pl/polgrabia/demos/crackingcodeinterview/t17x9/Program.kt @@ -6,7 +6,7 @@ fun main() { print("K number: ") val kNumber = readln().toInt() - var arr = Array(maxSize + 1, { false }) + val arr = Array(maxSize + 1, { false }) for (i in 3 until maxSize + 1 - kNumber step 3) { arr[i] = true }