Zero to Hero
article thumbnail
39. Combination Sum
Algorithm 2021. 5. 11. 10:01

Combination Sum - LeetCode 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 1. 내 Trash Garbage Code from typing import * # DP로 풀어야할 것 같다 # 완전탐색으로 하면 반드시 TLE가 날 것 같은 문제 # 라고 생각했는데 노트에 써보니깐 백트래킹 문제 같다. class Solution: def combinationSum(self, candidates: List[int], target: int) -> List[List[in..

article thumbnail
49. Group Anagrams
Algorithm 2021. 5. 10. 09:25

Group Anagrams - LeetCode 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 1. 소팅된 문자열을 Key로 하는 Dict(HashMap)을 이용한 풀이 class Solution: def groupAnagrams(self, strs: List[str]) -> List[List[str]]: dict1={} for str in strs: temp="".join(sorted(list(str))) if temp not in dict1: dict1[temp]=[str] ..

article thumbnail
21.05.09.
Diary 2021. 5. 9. 21:06

1. Leetcoding... 최근 Java를 많이 사용하고 있어서 어렵게 쌓아 올린 Python에 대한 감을 잃지 않도록 풀고 있다. 굉장히 유익하고 머리가 말랑말랑 해지는 기분이 들어서 좋다. 국내 온라인 저지들과는 또 다른 느낌이어서 신선하기도 하다. 2. 북마크, 팔로워, 피드 북마크 유용한 자료들을 북마크 해서 정리한 지 6년째가 된다. 모든 걸 다 기억하진 못 해도 내가 찾으려던 걸 북마크 해놨다는 기억은 오래 남아서 그런지 간간히 북마크 검색을 통해 필요한 자료를 꺼내서 보면 도움이 된다. 팔로워, 피드 깃허브 팔로잉, 블로그 피드 등을 통해서 굉장히 좋은 정보를 얻을 수 있다. 특히 열심히 활동하시는 분들이 요즘 어떤 기술에 관심이 있으시고, 어떤 걸 공부하시는지 보면 방향성을 잡을 수 있..

article thumbnail
48. Rotate Image
Algorithm 2021. 5. 9. 12:20

Rotate Image - LeetCode 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차원 배열이 주어지면 추가 공간 할당 없이 시계 방향으로 회전시키는 문제 1. Swap class Solution: def rotate(self, matrix: List[List[int]]) -> None: length = len(matrix) for i in range(length // 2 + length % 2): for j in range(length // 2): temp = ..

article thumbnail
347. Top K Frequent Elements
Algorithm 2021. 5. 8. 22:07

Top K Frequent Elements - LeetCode 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 1. Using Counter from typing import * from collections import Counter class Solution: def topKFrequent(self, nums: List[int], k: int) -> List[int]: counter_dict = Counter() for num in nums: counter_dict[num] ..

article thumbnail
친절한 SQL 튜닝 05
Review 2021. 5. 8. 21:42

조인 전략 NL 조인(Nested Loop) - 가장 기본이 되는 전략 - 조인 대상이 되는 두 테이블의 인덱스를 이용한다. - Outer Table, Inner Table로 나눠서 작업한다. - 사원 테이블과 고객 테이블이 있다고 가정하자. - 고객 테이블에는 해당 고객을 담당하는 사원의 ID가 column으로 있다. - 이 두 테이블을 JOIN 할 때 양쪽 테이블 모두 인덱스를 사용한다. - Outer Table 쪽은 테이블 사이즈에 따라서 사용하지 않을 수도 있다.(Full Scan이 빠른 경우) - 하지만 Inner Table 쪽은 반드시 인덱스를 사용해야 한다. 그렇지 않으면 For Loop처럼 Inner Table Full Scan * Outer Table에서 읽은 횟수만큼 Full Scan이..