Hashtable1 Hash Table 1.Two sum 문제 https://leetcode.com/problems/two-sum/ 문제풀이: Hash table을 이용하여 key = num, value = index의 dictionary를 이용하여 풀이+ ) enumerate() 함수: index와 value값을 모두 전달함 형식:enumerate(iterable obective, start= 0)from typing import Listdef twoSum(nums: List[int], target: int) -> List[int]: hashtable = {} # dictionary 선언#enumerate()함수는 index와 value값을 모두 전달함 for idx, num in enumerate(nums): .. 2024. 6. 11. 이전 1 다음