This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package org.kotlinlang.play | |
fun main() { | |
val num1 = intArrayOf(1,2) | |
val num2 = intArrayOf(3,4) | |
println(findMedianSortedArrays(num1, num2)) | |
} | |
fun findMedianSortedArrays(nums1: IntArray, nums2: IntArray): Double { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package org.kotlinlang.play | |
fun main() { | |
val input = mapOf( | |
-999 to -5999, | |
999 to 9995, | |
9643 to 96543, | |
-132 to -1325 | |
) | |
val added = 5 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package org.kotlinlang.play | |
import java.math.BigInteger | |
fun main() { | |
val input = mapOf( | |
-999 to -5999, | |
999 to 9995, | |
9643 to 96543 | |
) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package org.kotlinlang.play | |
fun main() { | |
val sample = "Replace every second character of a word in a text with a specific symbol" | |
val words = sample.split(" ") | |
println(replaceCharInWords(words).joinToString(" ")) | |
} | |
fun replaceCharInWords(words: List<String>, index: Int = 1, with: Char = '@'): List<String> { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package org.kotlinlang.play | |
//Playground: https://pl.kotl.in/5Cjs0Zde6 | |
fun main() { | |
val k = 10 | |
val sample = arrayOf(1,1,2,23,4,9,13,6,9) | |
val result = indexOfAddUp(sample, k) | |
println(result) | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Kotlin code challenges. | |
* | |
*/ | |
fun main() { | |
println("${rev(465, 0)}") | |
} | |
fun rev(number: Int, temp: Int): Int { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Kotlin code challenges. | |
* playground: https://pl.kotl.in/h9tfWDn6q | |
*/ | |
import java.util.* | |
import kotlin.collections.ArrayList | |
fun main() { | |
val message = "Hello, world!" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Kotlin code challenges. Find related objects | |
* playground: https://pl.kotl.in/x4pqB-guK | |
*/ | |
import java.util.* | |
import kotlin.collections.ArrayList | |
fun main() { | |
val message = "Hello, world!" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Kotlin code challenges. Find related objects | |
* playgound: https://pl.kotl.in/NvjzuL7se | |
*/ | |
import java.util.* | |
import kotlin.collections.ArrayList | |
fun main() { | |
val message = "Hello, world!" |
NewerOlder