본문 바로가기

분류 전체보기351

[leetcode 332] Reconstruct Itinerary 내가 이 문제를 푼 적이 있었다니 전혀 기억이.. 문제 난이도는 hard이다. 다시 풀어도 또 못 풀꺼 같다. https://leetcode.com/problems/reconstruct-itinerary/description/ Reconstruct Itinerary - LeetCode Can you solve this real interview question? Reconstruct Itinerary - You are given a list of airline tickets where tickets[i] = [fromi, toi] represent the departure and the arrival airports of one flight. Reconstruct the itinerary in order.. 2023. 4. 15.
[Docker] 도커 명령어 정리 # Dockerfile을 사용해서 도커 이미지 빌드하기 #.없으면 오류남 주의 docker build -t [빌드할 이미지 이름] . # 이미지를 사용하여 컨테이너 실행 docker run --name [컨테이너 이름] \ -d \ # 백그라운드 실행 -p [외부 포트]:[도커 내부 포트] \ # 포트연동 [이미지 이름] # 실행된 컨테이너의 bash 실행 docker exec -it [컨테이너 이름] bash # 컨테이너 종료 docker stop [컨테이너 이름] # docker hub에 이미지 푸쉬하기 docker push [이미지명] # 도커 이미지 리스트 조회 docker images # 컨테이너 리스트 조회 docker ps # run중인 컨테이너 확인 docker ps -a # run & e.. 2023. 4. 15.
[알고리즘] Directed Graph에서 사이클 찾기 방향이 있는 그래프에서 싸이클을 찾는 방법을 알아보자. Using BFS Kahn 알고리즘을 사용한다. www.geeksforgeeks.org/detect-cycle-in-a-directed-graph-using-bfs/ Detect Cycle in a Directed Graph using BFS - GeeksforGeeks A Computer Science portal for geeks. It contains well written, well thought and well explained computer science and programming articles, quizzes and practice/competitive programming/company interview Questions. www.. 2023. 4. 15.
[Java] 음수 나머지 구하기 자바와 c는 음수에서 나머지 연산을 하면 음수 값이 나온다. (번외: 파이썬의 경우 양수로 나온다.) -7 % 3 // -1 하지만 나머지 연산 정의에서 나머지는 0보다 커야 한다. 따라서 자바에서 나머지 연산을 구하기 위해선 나머지가 음수일 경우 나누는 수만큼 더해줘야 한다. // num은 나눠지는 수 k는 나누는 수 int rest = num % k; if(rest < 0) rest += k; num = division * quotient + remainder일 때 num = division * ( quotient - 1 ) + remainder + division 을 해준 것이다. 2023. 3. 26.