ARTS
Sun, 22 Dec 2019 17:16:04 +0000
- A (Algotithm) 至少做一个leetcode的算法题
- R (Review) 阅读并点评一篇英文的技术文章
- T (Tip) 学习一个技术技巧
- S (Share) 分享一篇有观点和思考的技术文章
每周一次,坚持一年
Algorithm
Description Jewels and Stones
Solution
// 1 ms 34.9 MB
// 暴力破解,理论上是最慢的,但是这里最快
class Solution {
public int numJewelsInStones(String J, String S) {
int stones = 0;
for (char s: S.toCharArray()) {
for (char j: J.toCharArray()) {
if (s == j) {
stones++;
break;
}
}
}
return stones;
}
}
Review
Tip
Share
blog comments powered by Disqus