일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
- list
- Binary
- 재귀
- 문자열
- binary search
- dfs
- sorting
- Python
- two pointers
- math
- HashTable
- 쉬움
- Array
- tree
- hash table
- 중간
- 리트코드
- 미디움
- binary tree
- 이진트리
- Depth-first Search
- easy
- recursive
- DP
- backtracking
- string
- Medium
- matrix
- leetcode
- linked list
- Today
- Total
목록HashTable (8)
부부의 코딩 성장 일기
1. 문제 링크 https://leetcode.com/problems/valid-anagram/description/ LeetCode - The World's Leading Online Programming Learning Platform Level up your coding skills and quickly land a job. This is the best place to expand your knowledge and get prepared for your next interview. leetcode.com 2. 문제 설명 문자열 s와 t가 주어졌을 때, 만약 t가 s의 Anagram이라면 True를 반환, 아니라면 False를 반환 여기서 Anagram이란, 일반적으로 모든 원래 문자를 정확히 한..
1. 문제 링크 https://leetcode.com/problems/group-anagrams/ Group Anagrams - LeetCode Can you solve this real interview question? Group Anagrams - Given an array of strings strs, group the anagrams together. You can return the answer in any order. An Anagram is a word or phrase formed by rearranging the letters of a different word or phrase leetcode.com 2. 문제 설명 문자열로 구성된 array strs가 주어졌을 때, anagrams로..
1. 문제 링크 https://leetcode.com/problems/isomorphic-strings/ Isomorphic Strings - LeetCode Can you solve this real interview question? Isomorphic Strings - Given two strings s and t, determine if they are isomorphic. Two strings s and t are isomorphic if the characters in s can be replaced to get t. All occurrences of a character must be replace leetcode.com 2. 문제 설명 두 문자열 s와 t가 주어졌을 때, 두 문자열이 iso..
1. 문제 링크 https://leetcode.com/problems/happy-number/ Happy Number - LeetCode Can you solve this real interview question? Happy Number - Write an algorithm to determine if a number n is happy. A happy number is a number defined by the following process: * Starting with any positive integer, replace the number by the sum of the squar leetcode.com 2. 문제 설명 주어진 수가 happy 넘버인지 따져서 True, False 반환 여기서 h..
1. 문제 링크 https://leetcode.com/problems/integer-to-roman/submissions/ 2. 문제 설명 우리가 쓰는 정수가 주어지면 Roman 숫자로 바꾸어 return 하는 문제 아래의 기호를 이용함 I: 1 V: 5 X: 10 L: 50 L: 100 D: 500 M: 1000 이 때, I는 V,X 앞에 쓰여서 4,9를 나타냄 X는 L,C 앞에 쓰여서 40,90을 나타냄 C는 D,M 앞에 쓰여서 400,900을 나타냄 예시) 3 → III, 58 → LVIII, 1994 → MCMXCIV 3. 처음 풀이 딱히 특별한 알고리즘이 없을 것 같아서, 정수에 매칭되는 로마 문자에 대한 dictionary를 만들어두고, num 이 특정 숫자 이상이면, 그 숫자에 대한 로마 문..
1. 문제 링크 https://leetcode.com/problems/majority-element/ Majority Element - LeetCode Can you solve this real interview question? Majority Element - Given an array nums of size n, return the majority element. The majority element is the element that appears more than ⌊n / 2⌋ times. You may assume that the majority element always exists leetcode.com 2. 문제 설명 크기가 n인 배열이 주어졌을 때, majority element를 반환..
1. 문제 링크 https://leetcode.com/problems/intersection-of-two-linked-lists/ 2. 문제 설명 사이클이 없는 두 개의 연결 리스트(Linked List)가 주어졌을 때 교차하는 곳을 시작점으로 하는 연결 리스트를 반환하는 문제 예시) a1 → a2 → c1 → c2 → c3와 b1 → b2 → b3 → c1 → c2 → c3가 주어지면 c1에서 교차하기 때문에 연결 리스트 c1 → c2 → c3를 반환 3. 처음 풀이 a1을 시작으로 .next를 통해 한 칸 씩 앞으로 가며 끝까지 집합 seen에 저장하고 b1부터 시작하여 seen 에 있는 지 판단하여 아니면 한 칸 전진, 이미 나온 노드면 교차점으로 판단 하여 반환 시간 복잡도 O(m+n) # Def..
1. 문제 링크 https://leetcode.com/problems/roman-to-integer/ 2. 문제 설명 문제 자체는 심플, 로마 숫자를 정수로 반환하는 함수 (I, V, X ,L, .. 에 대응되는 정수값은 제공이 된다) 다만 숫자로 변환되는 규칙이 약간 생소 → 알고리즘 보다는 규칙을 찾는게 핵심 예시) II : 1+1=2, XII : 10+1+1=12, XXVII : 10+10+2+5=27 헷갈리는 규칙 4는 IIII라 쓰지 않고, IV로 표현 - 5에서 1을 뺀 값으로 작성 I는 4,9를 만들기 위해 V,X 앞에 등장할 수 있고, X는 40,90을 만들기 위해 L,C앞에 등장 가능 3. 처음 풀이 로마 문자를 key, 대응되는 정수를 value로 한 dictionary를 사전에 정의를..