240819

Regular Kim·2024년 8월 19일
0

회고

목록 보기
55/59

240819 회고 💬

한 달 열대야에 에어컨을 혹사시키고 있다. 에어컨을 매일 틀어 놓기 때문에 전기세 걱정, 에어컨이 고장날까 하는 걱정 등을 수시로 하고 있다. 백수가 이렇게 편하게 지내도 되는걸까... 🤑 집돌이가 집에만 있으니 좋기만 하다 ㅋㅋㅋ 🤣 오랜만에 주말 외출을 했다(저번 주에도 나갔다온건 안 비밀). 주말에 중요한 행사가 있어서 하루 늦은 회고를 작성한다. 8월의 셋 째 주를 되돌아본다.

Keep 👍

  • 이번 주에도 알고리즘 문제 풀이를 7일 연속 해냈다.
    - 침투 오랜만에 DFS 문제를 풀었다. 예전부터 풀어보려고 여러 번 시도 했지만 결국 해결을 못해서 묵혀두고 있었던 문제다. 방문 확인 배열을 매번 새로 만들어서 시간 초과가 났었다. 새로 생성 안 하도록 변경하고 풀이에 성공했다.
    - 백대열 최대공약수를 구하는 문제다. 유클리드호제법을 알고 있다면 금방 풀 수 있다.
  • 함께 자라기, 애자일로 가는 길을 계속 읽고 있다.
  • 이번 주에는 도커를 공부했다. 사실 할일이 많은데 오랫동안 앓고 있던 지병이 또 도져서... 해야하는 공부는 안 하고 도커 이론 공부를 오래했다. 그리고 소셜 로그인을 공부하고 있다. 구글, 네이버, 카카오 로그인을 해보려고한다. 연결은 어렵지 않은데 JWT 발급, 사용이 생각보다 까다로워서 애를 먹고 있다.
    - 이미지와 컨테이너의 차이
    - 이미지 레이어
    - 도커 명령어 기초
    - 소셜 로그인
    - JWT 토큰
    - UserDetails

Problem 🤢

Try 🧚

  • 함께 자라기 마무리하기
  • 알고리즘 문제 풀이
  • 토이 프로젝트 JWT 도입하기
    - JWT 로그인
    - 로그아웃
    - JPA 엔티티 설계

Extras 😀

침투


import java.io.*;
import java.util.*;

public class Main {
    public static void main(String[] args) {
        try (BufferedReader br = new BufferedReader(new InputStreamReader(System.in))) {

            Solution s = new Solution();
            System.out.println(s.solution(getInput(br)));

        } catch (IOException e) {
            throw new RuntimeException(e);
        }
    }

    private static int[][] getInput(BufferedReader br) throws IOException {
        String[] dimension = br.readLine().split(" ");
        int x = Integer.parseInt(dimension[0]);
        int y = Integer.parseInt(dimension[1]);
        int[][] field = new int[x][y];

        for (int i = 0; i < field.length; i++) {
            String[] temp = br.readLine().split("");
            for (int j = 0; j < field[i].length; j++) {
                field[i][j] = Integer.parseInt(temp[j]);
            }
        }
        return field;
    }
}

class Solution {

    public String solution(int[][] fabric) {
        Calculator c = new Calculator(fabric);
        return c.getResult();
    }
}

class Calculator {

    int[][] fabric;
    boolean[][] isChecked;
    int[][] directions = {{0, 1}, {1, 0}, {0, -1}, {-1, 0}};
    boolean isPercolate = false;

    public Calculator(int[][] fabric) {
        this.fabric = fabric;
        this.isChecked = new boolean[fabric.length][fabric[0].length];
    }

    public String getResult() {
        for (int i = 0; i < fabric[0].length; i++) {
            if (fabric[0][i] == 0) {
                DFS(0, i);
            }
            if(isPercolate) return "YES";
        }
        return "NO";
    }

    private void DFS(int x, int y) {
        isChecked[x][y] = true;

        if (x == fabric.length - 1 && fabric[x][y] == 0) {
            isPercolate = true;
            return;
        }

        for (int[] direction : directions) {
            int nx = x + direction[0];
            int ny = y + direction[1];

            if (isWithinFabric(nx, ny) && fabric[nx][ny] == 0 && !isChecked[nx][ny]) {
                DFS(nx, ny);
            }
        }
    }

    private boolean isWithinFabric(int x, int y) {
        return 0 <= x && x < fabric.length && 0 <= y && y < fabric[x].length;
    }
}

백대열


import java.io.*;

public class Main {

    public static void main(String[] args) {
        try (BufferedReader br = new BufferedReader(new InputStreamReader(System.in))) {

            Solution s = new Solution();
            System.out.println(s.solution(getInput(br)));

        } catch (IOException e) {
            throw new RuntimeException(e);
        }
    }

    private static int[] getInput(BufferedReader br) throws IOException {
        String[] tokens = br.readLine().split(":");
        int num1 = Integer.parseInt(tokens[0]);
        int num2 = Integer.parseInt(tokens[1]);
        return new int[]{num1, num2};
    }
}

class Solution {

    public String solution(int[] nums) {
        int GDC = getGDC(Math.max(nums[0], nums[1]), Math.min(nums[0], nums[1]));
        return nums[0] / GDC + ":" + nums[1] / GDC;
    }

    private int getGDC(int bigger, int smaller) {
        if(smaller == 0) return bigger;
        return getGDC(smaller, bigger % smaller);
    }
}

독서 목록

서평 완료 목록

서평 예정 목록 (읽는 중)

  • 프로그래머의 길, 멘토에게 묻다
  • 함께 자라기 애자일로 가는 길

독서 예정 목록

목록은 우선순위 큐이다. 상단에 있더라도 더 중요한 책이 들어온다면 순위가 뒤로 밀릴 수 있다.

  • 객체지향의 사실과 오해
  • 오브젝트
  • 파이브 라인스 오브 코드
  • HTTP 완벽 가이드
  • 자바/스프링 개발자를 위한 실용주의 프로그래밍
  • 모던 자바 인 액션
  • 자바 성능 튜닝 이야기
  • 자바 개발자와 시스템 운영자를 위한 트러블 슈팅 이야기 / scouter를 활용한 시스템 장애 진단 및 해결 노하우 자바 트러블슈팅
  • 헤드 퍼스트 서블릿
  • Hello Coding 그림으로 개념을 이해하는 알고리즘
profile
What doesn't kill you, makes you stronger

0개의 댓글