FunctionRacerProblemsRace

Find Words Containing Character

BeginnerStringsPython, JavaScript, TypeScript, Java, C++

Return the indices of the words in words that contain the single character x, in increasing order. If no word contains it, return an empty list.

Example 1

words ["leet","code"]
x "e"
returns [0,1]

Both words contain e.

Example 2

words ["abc","bcd","aaaa","cbc"]
x "a"
returns [0,2]

Words 0 and 2.

Constraints

Race itor take your time

Write it in your browser, against the clock. The model solution, stepped through line by line, comes after.

More Strings problems