목록분류 전체보기 (166)
공부기록
문제 https://programmers.co.kr/learn/courses/30/lessons/60063 코드 import java.util.*; class Solution { int mv[][] = { {-1,0}, {0,1}, {1,0}, {0,-1} }; int spin[][] = { {-1,0}, {-1,1}, {0,1}, {1,1}, {1,0}, {1,-1}, {0,-1}, {-1,-1} }; class Node implements Comparable{ int row; int col; public Node(int row, int col){ this.row = row; this.col = col; } @Override public int compareTo(Node obj){ if(this.row..
문제 https://programmers.co.kr/learn/courses/30/lessons/72415 코드 import java.util.*; class Solution { static int count = 0; static int min = 2000000000; int mv[][] = { {-1, 0}, {0, 1}, {1,0}, {0,-1} }; class Node{ int row; int col; int depth; public Node(int row, int col){ this.row = row; this.col = col; this.depth = 0; } public Node(int row, int col, int depth){ this.row = row; this.col = col; th..
문제 https://programmers.co.kr/learn/courses/30/lessons/72414 코드 class Solution { int makeIntTime(String time){ int hours = (time.charAt(0)-'0')*10+(time.charAt(1)-'0'); int minutes = (time.charAt(3)-'0')*10+(time.charAt(4)-'0'); int seconds = (time.charAt(6)-'0')*10+(time.charAt(7)-'0'); return hours*60*60 + minutes*60 + seconds; } String timeToStr(..
문제 https://programmers.co.kr/learn/courses/30/lessons/86053?language=cpp 코드 #include #include #include using namespace std; long long solution(int a, int b, vector g, vector s, vector w, vector t) { long long answer = 400000000000000; long long high = answer; long long low = 0; while(low = a+b && gSum >= a && sSum >= b 이렇게 해도 되는 이유는 다음과 같다. 먼저 금 요구량과 은 요구량을 합산한 양을 옮길 수 있는 지 찾는 것은 자명하다. 위 조건을 만족하..
SOLID 원칙이 필요한 이유 SOLID 원칙은 객체지향 프로그래밍을 하면서 모듈간의 잘못된 의존성을 줄이기 위해서 필요하다. 처음에 프로그램을 설계할 때 자신만의 구조가 있을 것이다. 하지만 이 프로그램이 변경되면서 처음의 구조가 무너지면서 점차 잘못된 의존성이 생겨나게 된다. 이 잘못된 의존성 에 의해 나타나는 4가지 문제는 다음과 같다. Rigidity Rigitiy(이하 경직성)은 프로그램이 변경되기 어려워지는 것을 말한다. 모듈간의 결합도가 강해지면서, 한 모듈을 수정하면 다른 모듈을 수정하고, 그 수정에 의해 또 다른 모듈의 수정이 필요해지면서 점차 프로그램을 변경하는데 너무 많은 공수가 필요하게 된다. Fragility Fragility(이하 취약성)은 프로그램이 변경될 때마다 그 변경이 프..
문제 https://programmers.co.kr/learn/courses/30/lessons/81303 코드 import java.util.*; class Solution { class Node{ int idx; Node prev; Node next; public Node(int idx, Node prev, Node next){ this.idx = idx; this.prev = prev; this.next = next; } } public String solution(int n, int k, String[] cmd) { String answer = ""; StringBuilder sb = new StringBuilder("O".repeat(n)); Stack q = new Stack(); Node h..
Thymeleaf 마크업을 깨지않는 문법 브라우저로 바로 열기가능 스프링이 지원함 (Spring native) 문법이 문서를 많이 봐야됨 ㅜㅜ 템플릿 경로가 설정이 되어있어 해당 경로에 템플릿을 작성하면 알아서 로딩됨 resources/templates/${템플릿 이름}이 기본값 이 부분은 설정파일의 설정값을 바꾸면 된다. spring-boot-devtools를 import하면 템플릿을 수정후 서버만 recompile하면 템플릿 변경사항이 반영됨. H2 Database 개발, 테스트용 DB 웹화면을 제공 세팅방법 h2 database 설치 설정을 Generic H2 (Server)로 설정 jdbc:h2:~/jpashop 으로 접속해서 C:/USER/SUA 폴더에 jpashop.mv.db를 생성, 이후에 ..
문제 https://programmers.co.kr/learn/courses/30/lessons/86048# 코드 import java.util.*; class Solution { public int[] solution(int[] enter, int[] leave) { int[] answer = new int[enter.length]; Stack s1 = new Stack(); Stack s2 = new Stack(); HashSet his = new HashSet(); for(int i = enter.length-1; i>=0; i--) s1.add(enter[i]); for(int i=0; i