All Downloads are FREE. Search and download functionalities are using the official Maven repository.

g2901_3000.s2942_find_words_containing_character.Solution.kt Maven / Gradle / Ivy

There is a newer version: 1.30
Show newest version
package g2901_3000.s2942_find_words_containing_character

// #Easy #Array #String #2024_01_07_Time_216_ms_(98.97%)_Space_37.6_MB_(98.46%)

class Solution {
    fun findWordsContaining(words: Array, x: Char): List {
        val ans: MutableList = ArrayList()
        for (i in words.indices) {
            for (j in 0 until words[i].length) {
                if (words[i][j] == x) {
                    ans.add(i)
                    break
                }
            }
        }
        return ans
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy