Created
May 7, 2021 23:37
-
-
Save bperin/50a2f6d25162fb4f06f7f71f9d2e52a2 to your computer and use it in GitHub Desktop.
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
import java.io.* | |
import java.math.* | |
import java.security.* | |
import java.text.* | |
import java.util.* | |
import java.util.concurrent.* | |
import java.util.function.* | |
import java.util.regex.* | |
import java.util.stream.* | |
import kotlin.collections.* | |
import kotlin.comparisons.* | |
import kotlin.io.* | |
import kotlin.jvm.* | |
import kotlin.jvm.functions.* | |
import kotlin.jvm.internal.* | |
import kotlin.ranges.* | |
import kotlin.sequences.* | |
import kotlin.text.* | |
/* | |
* Complete the 'isPangram' function below. | |
* | |
* The function is expected to return a STRING. | |
* The function accepts STRING_ARRAY pangram as parameter. | |
*/ | |
fun isPangram(pangram: Array<String>): String { | |
val builder = StringBuilder() | |
pangram.forEach { sentences -> | |
val letterHashMap = mutableListOf<Char>() | |
sentences.toCharArray().forEach { char -> | |
if (!letterHashMap.contains(char)) { | |
letterHashMap.add(char) | |
} | |
} | |
if (letterHashMap.size == 26) { | |
builder.append(1) | |
} else { | |
builder.append(0) | |
} | |
} | |
return builder.toString() | |
} | |
fun main(args: Array<String>) { | |
val pangramCount = readLine()!!.trim().toInt() | |
val pangram = Array<String>(pangramCount, { "" }) | |
for (i in 0 until pangramCount) { | |
val pangramItem = readLine()!! | |
pangram[i] = pangramItem | |
} | |
val result = isPangram(pangram) | |
println(result) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment