Count the Number of Consistent Strings, Leetcode#1684 | Leetcode solution

preview_player
Показать описание
Solution for leetcode problem 1684, Count the Number of Consistent Strings
Simple C++ solution
Leetcode Bi-WeeklyChallenge
Time Complexity: O(N * L) - N: number of words, L - length of word
Space Complexity: ~O(1)

Рекомендации по теме
Комментарии
Автор

Detailed explanation 👌 thankyou so much

saiguruju
Автор

In the present situation all videos of you are very useful to B.Tech students

venivadlamudi
Автор

Runtime: 5 ms, faster than 97.17% of Java online submissions for Count the Number of Consistent Strings.
Memory Usage: 39.2 MB, less than 98.73% of Java online submissions for Count the Number of Consistent Strings.

public int countConsistentStrings(String allowed, String[] words) {
int count = words.length;
boolean[] w = new boolean[26];
for(int i=0; i<allowed.length(); i++){
w[allowed.charAt(i)-'a'] = true;
}
for(int i=0; i<words.length;i++){
for(int j=0; j<words[i].length(); j++){

count--;
break;
}
}
}
return count;
}

sankalpjain
Автор

The way of you teach is Good lecture hope so many of them will got your lecture in these videos
all the best for your future videos 😊

sridevisridevi
welcome to shbcf.ru