![JAR search and dependency download from the Maven repository](/logo.png)
g1401_1500.s1408_string_matching_in_an_array.Solution.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of leetcode-in-kotlin Show documentation
Show all versions of leetcode-in-kotlin Show documentation
Kotlin-based LeetCode algorithm problem solutions, regularly updated
package g1401_1500.s1408_string_matching_in_an_array
// #Easy #String #String_Matching #2023_06_07_Time_194_ms_(77.78%)_Space_36.8_MB_(77.78%)
class Solution {
fun stringMatching(words: Array): List {
val set: MutableSet = HashSet()
for (word in words) {
for (s in words) {
if (word != s && word.length < s.length && s.contains(word)) {
set.add(word)
}
}
}
return ArrayList(set)
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy