본문 바로가기

전체 글

(248)
[해시 테이블] 31 상위 K 빈도 요소(Top K Frequent Elements) https://leetcode.com/problems/top-k-frequent-elements/ 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 collections.Counter를 이용하여 풀이한 첫번째 풀이는 다음과 같습니다. class Solution: def topKFrequent(self, nums: List[int], k: int) -> List[int]: count_dict = collections.Co..
[해시 테이블] 30 중복 문자 없는 가장 긴 부분 문자열(Longest Substring Without Repeating Characters) https://leetcode.com/problems/longest-substring-without-repeating-characters/ Longest Substring Without Repeating Characters - 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 중복 문자가 없는 가장 긴 부분 문자열(substring)의 길이를 리턴하는 문제입니다. 모든 substring을 탐색하여 시간복잡도 O(n2)으로 time out이 날것으로 예상했지만, 통과..
[해시 테이블] 29 보석과 돌(Jewels and Stones) https://leetcode.com/problems/jewels-and-stones/ Jewels and Stones - 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 jewels는 보석이고, stones는 갖고 있는 돌일때, stones에는 보석이 몇 개나 있을지 구하는 문제입니다. 이때 대소문자는 구분합니다. 파이썬의 collections.Counter를 이용하여 한 첫번째 풀이는 다음과 같습니다. class Solution: def numJewelsInS..
[해시 테이블] 28 해시맵 디자인(Design HashMap) https://leetcode.com/problems/design-hashmap/ Design HashMap - 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 다음 기능을 제공하는 해시맵을 디자인하는 문제입니다. put(key, value): 키,값을 해시맵에 삽입하고, 만약 이미 존재하는 키라면 업데이트한다. get(key): 키에 해당하는 값을 조회하고, 만약 키가 존재하지 않는다면 -1을 리턴한다. remove(key): 키에 해당하는 키, 값을 해시맵에서..
[데크, 우선순위 큐] 27 k개 정렬 리스트 병합(Merge k Sorted Lists) https://leetcode.com/problems/merge-k-sorted-lists/ Merge k Sorted Lists - 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 k개의 정렬된 리스트를 1개의 정렬된 리스트로 병합하는 문제입니다. 먼저 연결리스트의 모든 값들을 리스트에 넣은 후 풀이하는 방법은 다음과 같습니다. # Definition for singly-linked list. # class ListNode: # def __init__(self,..
[데크, 우선순위 큐] 26 원형 데크 디자인(Design Circular Deque) https://leetcode.com/problems/design-circular-deque/ Design Circular Deque - 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 배열을 통해 구현한 풀이는 다음과 같습니다. 크기가 k인 리스트를 배열로 사용합니다. class MyCircularDeque: def __init__(self, k): """ Initialize your data structure here. Set the size of the de..
Python 기술면접 정리 https://github.com/JaeYeopHan/Interview_Question_for_Beginner/tree/master/Python GitHub - JaeYeopHan/Interview_Question_for_Beginner: Technical-Interview guidelines written for those who started studying progr :boy: :girl: Technical-Interview guidelines written for those who started studying programming. I wish you all the best. :space_invader: - GitHub - JaeYeopHan/Interview_Question_for_Beginn..
WSGI(Web Server Gateway Interface)란 https://tibetsandfox.tistory.com/22 장고(Django) - WSGI(Web Server Gateway Interface) WSGI란? WSGI는 Web Server Gateway Interface의 줄임말로 파이썬의 표준 게이트웨이 인터페이스입니다. 파이썬에서의 CGI정도로 이해하시면 됩니다만 더 쉽게 생각하자면 일종의 프로토콜 처럼 생각할 수 tibetsandfox.tistory.com