Skip to content

Commit bf78e9e

Browse files
add 1961
1 parent 54a07e0 commit bf78e9e

File tree

2 files changed

+17
-0
lines changed

2 files changed

+17
-0
lines changed

README.md

+1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ _If you like this project, please leave me a star._ ★
88

99
| # | Title | Solutions | Video | Difficulty | Tag
1010
|-----|----------------|---------------|--------|-------------|-------------
11+
|1961|[Check If String Is a Prefix of Array](https://leetcode.com/problems/check-if-string-is-a-prefix-of-array/)|[Solution](../master/src/main/java/com/fishercoder/solutions/_1961.java) ||Easy||
1112
|1952|[Three Divisors](https://leetcode.com/problems/three-divisors/)|[Solution](../master/src/main/java/com/fishercoder/solutions/_1952.java) ||Easy||
1213
|1945|[Sum of Digits of String After Convert](https://leetcode.com/problems/sum-of-digits-of-string-after-convert/)|[Solution](../master/src/main/java/com/fishercoder/solutions/_1945.java) ||Easy||
1314
|1941|[Check if All Characters Have Equal Number of Occurrences](https://leetcode.com/problems/check-if-all-characters-have-equal-number-of-occurrences/)|[Solution](../master/src/main/java/com/fishercoder/solutions/_1941.java) ||Easy||
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
package com.fishercoder.solutions;
2+
3+
public class _1961 {
4+
public static class Solution1 {
5+
public boolean isPrefixString(String s, String[] words) {
6+
StringBuilder sb = new StringBuilder();
7+
for (String word : words) {
8+
sb.append(word);
9+
if (sb.toString().equals(s)) {
10+
return true;
11+
}
12+
}
13+
return false;
14+
}
15+
}
16+
}

0 commit comments

Comments
 (0)