LeetCode44 [Leetcode] 146. LRU Cache 문제 요약 알고리즘 분류: Hash, 자료구조, 링크드 리스트 난이도: Medium 문제내용: LRU Cache class 구현해라 LRUCache(int capacity) capacity은 용량 사이즈이다. get 메소드는 key가 있을경우 값을 출력하고 아닐경우 -1로 출력한다. put 메소드는 값을 집어 넣는다. 용량이 초과 할경우 최근 사용도 순으로 삭제한다. 사이트 주소: https://leetcode.com/problems/lru-cache/description/ LRU Cache - LeetCode Can you solve this real interview question? LRU Cache - Design a data structure that follows the constraints .. 2024. 3. 6. [Leetcode] 1. Two Sum 문제 요약 알고리즘 분류: 브루트포스, 배열 난이도: easy 문제내용: nums 배열 2개 뽑아서 target 숫자 맞는 인덱스 위치를 반환 하여라. 사이트 주소: https://leetcode.com/problems/two-sum 문제풀이 이번 문제는 간단한 배열 탐색이다. 구현은 아래와 같은 방식으로 하면 된다. 1. 이중 반복문으로 한다. - 첫번째는 배열의 길이 만큼 한다. - 두번째는 탐색 위치 i+1부터 배열 길이 탐색한다. 2. 두개 배열 위치에서 합해서 target 값이 같으면 배열 위치 반환한다. Code Python class Solution: def twoSum(self, nums: List[int], target: int) -> List[int]: length = len(nums).. 2024. 3. 5.