Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | ||||
4 | 5 | 6 | 7 | 8 | 9 | 10 |
11 | 12 | 13 | 14 | 15 | 16 | 17 |
18 | 19 | 20 | 21 | 22 | 23 | 24 |
25 | 26 | 27 | 28 | 29 | 30 | 31 |
Tags
- 파이썬
- 자바
- Data Structure
- Counting
- bit manipulation
- 코딩테스트
- Stack
- database
- Class
- Binary Search
- array
- SQL
- sorting
- Matrix
- simulation
- Number Theory
- hash table
- string
- two pointers
- java
- implement
- dynamic programming
- geometry
- 코테
- Math
- Binary Tree
- greedy
- 구현
- Tree
- Method
Archives
- Today
- Total
코린이의 소소한 공부노트
[LeetCode/Easy] 1967. Number of Strings That Appear as Substrings in Word 본문
코딩테스트 풀이/JAVA
[LeetCode/Easy] 1967. Number of Strings That Appear as Substrings in Word
무지맘 2023. 1. 9. 00:071. Input
1) 문자열 배열 patterns
2) 문자열 word
2. Output
1) patterns의 요소들 중 word의 substring 개수를 반환
3. Constraint
1) 1 <= patterns.length <= 100
2) 1 <= patterns[i].length <= 100
3) 1 <= word.length <= 100
4) patterns의 요소들과 word는 영어 소문자로만 이루어져 있다.
4. Example
Input: patterns = ["a","abc","bc","d"], word = "abc" -> Output: 3
설명: abc의 substring이 될 수 있는 것은 a, abc, bc 3개가 있다.
5. Code
1) 첫 코드(2022/06/14)
int count = 0;
for(int i=0 ; i<patterns.length ; i++){
if(word.contains(patterns[i]))
count++;
}
return count;
'코딩테스트 풀이 > JAVA' 카테고리의 다른 글
[LeetCode/Easy] 1991. Find the Middle Index in Array (0) | 2023.01.09 |
---|---|
[LeetCode/Easy] 1979. Find Greatest Common Divisor of Array (0) | 2023.01.09 |
[LeetCode/Easy] 1961. Check If String Is a Prefix of Array (0) | 2023.01.08 |
[LeetCode/Easy] 1952. Three Divisors (0) | 2023.01.08 |
[LeetCode/Easy] 1941. Check if All Characters Have Equal Number of Occurrences (0) | 2023.01.08 |