Created
July 21, 2022 10:22
-
-
Save erudenko/b9b01af777ac17b27173197c887482ec to your computer and use it in GitHub Desktop.
Adnroid interview
This file contains 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
const val text1 = "I love big red ballon" | |
const val expected1 = "I evol gib der nollab" | |
const val text2 = "I love big red ballon!" | |
const val expected2 = "I evol gib der nollab!" | |
fun main() { | |
val rev1 = reversed(text1) | |
if (expected1 != rev1) { | |
System.err.println("The test 1 failed, got: $rev1\nexpected:$expected1\n") | |
} else { | |
println("Test 1 passed!") | |
} | |
val rev2 = reversed(text2) | |
if (expected2 != rev2) { | |
System.err.println("The test 2 failed, got:$rev2\nexpected:$expected2\n") | |
} else { | |
println("Test 2 passed!") | |
} | |
} | |
fun reversed(s: String): String { | |
return s | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment