https://leetcode.com/problems/find-words-containing-character/description/
Find Words Containing Character - LeetCode
Can you solve this real interview question? Find Words Containing Character - You are given a 0-indexed array of strings words and a character x. Return an array of indices representing the words that contain the character x. Note that the returned array m
leetcode.com
1 2 3 4 5 6 7 8 9 | class Solution: def findWordsContaining(self, words: List[str], x: str) -> List[int]: answer = [] for i, word in enumerate(words): if x in word: answer.append(i) return answer | cs |
반응형
'python-algorithm' 카테고리의 다른 글
백준 14913 등차수열에서 항 번호 찾기 (0) | 2023.12.28 |
---|---|
leetcode 2928. Distribute Candies Among Children I (0) | 2023.12.27 |
leetcode 2951. Find the Peaks (0) | 2023.12.27 |
leetcode 2956. Find Common Elements Between Two Arrays (0) | 2023.12.27 |
leetcode 2965. Find Missing and Repeated Values (0) | 2023.12.27 |
댓글