Skip to content

Conversation

@tahazulfaquar
Copy link

Approach

  • Iterate through each word in the given list.
  • Check if the target character exists in the word using string.find().
  • If it exists, add the word to the result list.
  • Return the list of filtered words.

Intuition

  • string.find() returns string::npos if the character is not present, making it easy to check.
  • This approach is O(n * m) in time, where n = number of words, m = average length of a word.

Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for raising the PR, the owner will be review it soon' keep patience, keep contributing>>>!!! make sure you have star ⭐ the repo

@SjxSubham SjxSubham changed the title Add Leetcode problem 2942 Solution 2942. Find Words Containing Character Oct 4, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant