-
[LeetCode]Jewels and StonesAlgo 2019. 7. 6. 22:13
LeetCode 알고리즘 사이트는 Solution이 나와있고 Runtime 등 다른 사람들과 비교하여
내가 코드가 현재 어느 위치에 있는지 알 수 있기에 BOJ보다 요즘 많이 애용하게 된다.고러하여서 오늘 푼 문제는 아래와 같다.
-
문제
771. Jewels and Stones
개인적으로 생각했을때 For문 2개로 끝날 수 있다.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersclass Solution { fun numJewelsInStones(J: String, S: String): Int { var answer = 0 for(j in J){ for(s in S){ if(j==s){ answer++ } } } return answer } } LIST'Algo' 카테고리의 다른 글
[LeetCode]Palindrome Number (0) 2019.06.30 [LeetCode]Reverse Integer (0) 2019.06.22 [LeetCode] Climbing Stairs (0) 2019.05.06 [BOJ-2566]백준 알고리즘 2566 [Kotlin][Java] (0) 2019.04.28 [LeetCode] Two sum (0) 2019.03.10 -