Zero to Hero
article thumbnail
7. Reverse Integer
Algorithm 2021. 4. 17. 21:44

Reverse Integer - 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. 내 풀이 class Solution: def reverse(self, x: int) -> int: x = int(str(x)[::-1]) if str(x)[-1] != "-" else int("-" + str(x)[::-1][:-1]) return x if abs(x) < 2 ** 31 else 0

article thumbnail
M1 맥북에서 Docker + Tomcat 이미지 사용하기
Programming 2021. 4. 17. 21:17

M1 Docker가 정식 Release 되었다. 열심히 삽질해서 Tomcat 이미지에 HTML 파일을 올려서 접속하는 것을 성공했다. GUI 환경도 잘 되어있어서 가능하지만 이미지 검색할 때 회원가입을 해야 하는 귀찮음(?)때문에 전통적인 CLI방식으로 테스트해봤다. Docker Desktop for Apple silicon docs.docker.com 1. Docker 설치 이 부분은 기존의 맥 애플리케이션 설치할 때와 동일하게 진행하면 된다. 설치 후에 Docker의 아키텍처가 Apple인 것을 확인한다. Intel이라고 뜨면 M1용을 설치한 것이 아니니깐 주의. 2. Tomcat 이미지 파일 검색 및 다운로드 // docker hub의 tomcat 관련 이미지를 검색 docker search tom..

article thumbnail
104. Maximum Depth of Binary Tree
Algorithm 2021. 4. 16. 10:51

Maximum Depth 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. DFS를 이용한 내 풀이 class Solution: answer = 0 def maxDepth(self, root: TreeNode) -> int: def dfs(cur, depth): self.answer = max(self.answer, depth) if cur.left: dfs(cur.left, depth + 1) if cur.right: dfs(c..

21.04.16.
Diary 2021. 4. 16. 00:55

1. 팀 배치 후 한 달이 지나갔다. 협력사 분들이 보내주시는 정산 자료를 추합 해 종합 결과를 만드는 스크립트를 작성해 기존에 자료 추합에 걸리는 시간을 단축시켰다. 이번 달 안에 한 가지 작업을 더 할 예정이고, 잘 마무리해서 발표할 예정이다. 2. 방향성을 점검했다. 최근 좋은 기회가 있어 개발자로서의 공부 방향을 점검할 수 있는 기회가 있었다. 정말 유익한 시간이었고 아직 많이 부족하다고 느꼈다. 하지만 내 성장 방향성을 점검할 수 있었고, 힌트도 몇 가지 얻었다. 3. 공부할게 너무 많다. 다행인 건 지금 내 상황이 공부하기 상당히 괜찮다는 것. 최근에 관심은 있었지만 쉽게 익히지 못했던 기술들에 대해서 외부 강의를 신청했다. 한 번에 이해는 못하더라도 무엇인지 정도는 알 수 있도록 집중해야겠다.

13549번: 숨바꼭질 3
Algorithm 2021. 4. 15. 15:04

13549번: 숨바꼭질 3 수빈이는 동생과 숨바꼭질을 하고 있다. 수빈이는 현재 점 N(0 ≤ N ≤ 100,000)에 있고, 동생은 점 K(0 ≤ K ≤ 100,000)에 있다. 수빈이는 걷거나 순간이동을 할 수 있다. 만약, 수빈이의 위치가 X일 www.acmicpc.net import sys from collections import deque r = sys.stdin.readline src, dst = map(int, r().split()) visited = set() q = deque([]) q.append((src, 0)) result = 0 while q: cur_pos, cur_val = q.popleft() if cur_pos == dst: result = cur_val break if 0

article thumbnail
283. Move Zeroes
Algorithm 2021. 4. 15. 11:11

Move Zeroes - 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. 우선순위 큐를 이용해 zero index를 관리하는 해결법 from typing import * from heapq import * class Solution: def moveZeroes(self, nums: List[int]) -> None: q = [] for i in range(len(nums)): if nums[i] == 0: q.append(i) heapify(q) for i ..