Skip to content

Commit 4fc3a7f

Browse files
committed
fd
1 parent 2f42d5a commit 4fc3a7f

File tree

2 files changed

+18
-1
lines changed

2 files changed

+18
-1
lines changed

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -382,4 +382,5 @@
382382
|653|[Two Sum IV - Input is a BST](https://leetcode.com/problems/two-sum-iv-input-is-a-bst/)| [Java](leetcode/solution/src/TwoSumIV.java)|90||
383383
|654|[Maximum Binary Tree](https://leetcode.com/problems/maximum-binary-tree/description/)|[Java](leetcode/solution/src/MaximumBinaryTree.java)|100||
384384
|669|[Trim a Binary Search Tree](https://leetcode.com/problems/trim-a-binary-search-tree/)|[Java](leetcode/solution/src/TrimABinarySearchTree.java)|100||
385-
|684|[Redundant Connection](https://leetcode.com/problems/redundant-connection/)| [Java](leetcode/solution/src/RedundantConnection.java)|||
385+
|684|[Redundant Connection](https://leetcode.com/problems/redundant-connection/)| [Java](leetcode/solution/src/RedundantConnection.java)|||
386+
|771|[Jewels and Stones](https://leetcode.com/problems/jewels-and-stones/)|[Java](leetcode/solution/src/JewelsAndStones.java)|100||
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
public class JewelsAndStones {
2+
3+
public int numJewelsInStones(String J, String S) {
4+
int character[] = new int[256];
5+
for (char c : J.toCharArray()) {
6+
character[c]++;
7+
}
8+
int count = 0;
9+
for (char c : S.toCharArray()) {
10+
if (character[c] > 0) {
11+
count++;
12+
}
13+
}
14+
return count;
15+
}
16+
}

0 commit comments

Comments
 (0)