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
- 맛집
- LeetCode
- Find the Duplicate Number
- 코딩 테스트
- two pointers
- 6월 첼린지
- prefix sum
- 투포인터
- algorithm
- 망원 밥집
- 코테
- 발리인망원
- Array
- string
- map
- algorithum
- java
- linked list
- 해물감성포차
- findDulicate
- tree
- 른당사피
- Python
- 발리 음식
- invert Binary Tree
- 알고리즘
- 알탕뚝배기
- 사당돈
- two sum
- 코딩 테세트
Archives
- Today
- Total
목록map (2)
기록하는 공간
[leetcode/kotlin] 290.Word pattern
class Solution { fun wordPattern(pattern: String, str: String): Boolean { val strList = str.split(" ") if (pattern.length != strList.size) return false val map = mutableMapOf() for (i in strList.indices) { if (!map.containsValue(strList[i])) { map.put(pattern[i] , strList[i]) } } for (i in pattern.indices) { if (strList[i] != map.get(pattern[i])) { return false } } return true } }
알고리즘/leetcode
2020. 9. 8. 00:17
[leetcode/java] 287. Find the Duplicate Number
Map을 이용한 풀이 class Solution { public int findDuplicate(int[] nums) { int duplicateNumber = 0; int numsLength = nums.length; Map map = new HashMap(); for (int i : nums) { map.put(i, map.getOrDefault(i, 0) + 1); if (map.get(i) > 1) duplicateNumber = i; } return duplicateNumber; } }
알고리즘/leetcode
2020. 4. 11. 14:16