Fundamentals
fun main() = print("Hello world")
fun main(args: Array<String>) {println("Hello from Kotlin")}- fun main() = print("Hello world")
// You can test using JUnit or KotlinTest. JUnit is shown below // TODO: replace this example test with your own, this is just here to demonstrate usage. // TODO: replace with whatever your package is called package solution import kotlin.test.assertEquals import org.junit.Test class TestExample { @Test fun multiply() { assertEquals(4, 4) } }
- // You can test using JUnit or KotlinTest. JUnit is shown below
- // TODO: replace this example test with your own, this is just here to demonstrate usage.
- // TODO: replace with whatever your package is called
- package solution
- import kotlin.test.assertEquals
- import org.junit.Test
- class TestExample {
- @Test
- fun multiply() {
- assertEquals(4, 4)
- }
- }
Algorithms
Logic
Algorithms
Logic
getDividors = n => Array.from({length: n}, (e, i) => n % ++i ? i : 0).filter(e => e)
const getDividors = (n, result = []) => {for (let i = 1; i <= Math.floor(Math.sqrt(n)); i++)if (n % i === 0) { result.push(i); if (n / i !== i) result.push(n / i) }return result; // output array won't be sorted}- getDividors = n => Array.from({length: n}, (e, i) => n % ++i ? i : 0).filter(e => e)