Zero to Hero
article thumbnail
155. Min Stack
Algorithm 2021. 4. 30. 17:04

Min Stack - 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. event를 flag로 해서 처리하는 풀이 from heapq import * class MinStack: def __init__(self): self.stack = [] self.min_stack = [] self.events = [0] * 30000 self.event_cnt = 0 def push(self, val: int) -> None: self.stack.append((val, ..

article thumbnail
160. Intersection of Two Linked Lists
Algorithm 2021. 4. 30. 13:52

Intersection of Two Linked 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 1. 객체 ID값을 이용한 분기점 반환 class Solution: def getIntersectionNode(self, headA: ListNode, headB: ListNode) -> ListNode: a_id_list = [] b_id_list = [] p_a, p_b = headA, headB while p_a: a_id_list.append(id..

article thumbnail
70. Climbing Stairs
Algorithm 2021. 4. 29. 17:25

Climbing Stairs - 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. Dynamic Programming class Solution: def climbStairs(self, n: int) -> int: dp = [[0] * 2 for _ in range(46)] dp[1][0] = 1 dp[2][0] = 1 dp[2][1] = 1 for i in range(3, n + 1): dp[i][0] = sum(dp[i - 1]) dp[i][1] = sum..

article thumbnail
M1 맥북에서 Linux Ubuntu 사용하기 with AWS EC2
Programming 2021. 4. 29. 11:03

애플이 최근에 출시한 M1 프로세서를 사용한 MAC은 VMware, VirtualBox 등 무료 가상 머신을 사용할 수 없다. 현재까진 Parallels에서만 사용이 가능한 것으로 알고 있다. MAC OS는 기본적으로 터미널이 있고, 리눅스 기반 명령어를 사용할 수 있도록 환경이 어느 정도 갖추어져 있지만, 그 조상이 Linux가 아니라 라 Unix(Linux의 조상)이어서 그런진 몰라도 리눅스 환경에서 사용했던 명령어 일부가 지원하지 않거나 다른 명령어가 그 역할을 한다. 포인트는 공부 및 프로젝트 배포 실습을 위해선 Linux환경이 필요하다. 그래서 결국 대안으로 AWS EC2를 이용해 Linux 환경을 사용하기로 했다. 사실 AWS도 공부를 제대로 하고 사용해야 하는 기술 스택이지만 아직 배움이 부..

article thumbnail
543. Diameter of Binary Tree
Algorithm 2021. 4. 28. 15:04

Diameter of Binary Tree - 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. 실패한 코드 # Definition for a binary tree node. from typing import * from collections import deque # Definition for a binary tree node. class TreeNode: def __init__(self, val=0, left=None, right=None): self.va..

Spring Study 02
Programming 2021. 4. 28. 13:37

온라인 강의를 듣고 배운 점들을 기록한다. Bcrpyt & BcryptPasswordEncoder - Spring Security에서 제공하는 암호화 기법. - 내부적으로 임의의 salt값을 이용해 평문을 다이제스트(암호문)로 변환한다. - 즉 동일한 문자열에 대한 해시 결과가 매번 다르게 나온다. - 그러므로 위 라이브러리에서 제공하는 해시 비교 메서드를 통해서 비교할 수 있다. - Bcrpyt 라이브러리의 checkpw() 메서드를 통해 평문과 다이제스트를 비교할 수 있다. - BcryptPasswordEncoder는 AuthenticationProvider의 인자 값(UserDetailServices, PasswordEncoder)의 PasswordEncoder의 구현체로 가장 사용 빈도가 높은 구..