Back to June Back to Year 2026
EASY 29 Jun 2026 View on LeetCode

1967. Number of Strings That Appear as Substrings in Word

</> Solution

/**
 * Problem: LeetCode 1967 - Number of Strings That Appear as Substrings in Word
 * Difficulty: Easy
 * Language: Java
 * Author: CodeByTushu
 */
class Solution {
    public int numOfStrings(String[] patterns, String word) {
        int count = 0;

        for (String pattern : patterns) {
            if (word.contains(pattern)) {
                count++;
            }
        }

        return count;
    }
}

TIME COMPLEXITY

O(N * M * L)

SPACE COMPLEXITY

O(1)

TOPICS

String