words and a letter letter. Return the zero-based indices of every word that contains letter at least once.
The indices may be returned in any order.words=['river', 'stone', 'cloud', 'rain'], letter='r' → [0, 3]
The letter "r" occurs in "river" and "rain", at indices 0 and 3.
words=['moon', 'sun'], letter='k' → []
No word contains "k", so the answer is empty.
words.length ≤ 50words[i].length ≤ 50letter is a lowercase English letterwords[i] consists only of lowercase English letterswords=['river', 'stone', 'cloud', 'rain'], letter='r'
[0, 3]
Run checks the first 3 tests in your browser. Submit checks all 141 tests on the server, hidden ones included.