SSAFY 1학기가 끝났다. 동시에 2025년도 상반기가 끝났다. 1학기 내에 취업하기가 목표였는데,, 💀 하반기에는 꼭 성공하도록하자! 싸피 방학이 시작됐다. 시간이 많아진 만큼 건설적으로 사용할 계획이 필요하다.
알고리즘 문제 풀이를 계속 하고있다. 그날그날 기분따라서 아무 주제나 잡고 문제를 푼다.
리팩토링 강의를 듣고 있다. 기존에 객체 구분없이 만들어진 클래스들을 리팩토링하는 내용이다.
SOLID 원칙을 공부했다.
스프링 프로젝트를 진행할 때 properties, yml 등 외부 파일에서 설정 값을 가져오는 방법을 정리해봤다. 여기서 내용을 확인할 수 있다.
개인 프로젝트에 개선이 있었다.
완료 🙌 🙌 🙌 🙌
프론트 리팩토링
- axios 공통화 -> 인스턴스 사용하도록 변경
- 로그아웃 로직 개선
axios 사용 방법을 개선했다. 기존에는 페이지마다 axios를 선언하여 매번 헤더와 쿠키 사용 설정을 진행해줘야했다. 이제는 api 라는 이름의 인스턴스를 호출하기만하면 기타 설정은 통일된 axios를 사용할 수 있다.
export const api = axios.create({
baseURL: BASE_URL,
withCredentials: true,
})
개인 프로젝트 외에도 5월 월간 목표였던 MSA 공부도 조금이나마 성공했다.
두 가지 개념과, 예시 등을 공부했다. 슬슬 개인 프로젝트를 msa 구조로 변경해볼까 고려 중이다.
<한 권으로 읽는 컴퓨터 구조와 프로그래밍>을 계속 읽고 있다.
package main.BJ1074;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;
public class Main {
public static void main(String[] args) {
new Main().run();
}
private void run() {
Input ip = readInput();
System.out.println(new Solution().solution(ip.n, ip.r, ip.c));
}
private Input readInput() {
try (BufferedReader br = new BufferedReader(new InputStreamReader(System.in))) {
StringTokenizer st = new StringTokenizer(br.readLine());
int n = Integer.parseInt(st.nextToken());
int r = Integer.parseInt(st.nextToken());
int c = Integer.parseInt(st.nextToken());
return new Input(n, r, c);
} catch (IOException e) {
throw new RuntimeException();
}
}
private static class Input {
final int n;
final int r;
final int c;
public Input(int n, int r, int c) {
this.n = n;
this.r = r;
this.c = c;
}
}
}
class Solution {
public int solution(int n, int r, int c) {
int N = (int) Math.pow(2, n);
return calc(N, r, c, 0);
}
private int calc(int n, int r, int c, int cnt) {
if (n == 1) {
return cnt;
}
int half = n / 2;
int area = half * half;
if (r < half && c < half) { // 좌상 (2사분면)
return calc(half, r, c, cnt);
} else if (r < half && c >= half) { // 우상 (1사분면)
return calc(half, r, c - half, cnt + area);
} else if (r >= half && c < half) { // 좌하 (3사분면)
return calc(half, r - half, c, cnt + 2 * area);
} else { // 우하 (4사분면)
return calc(half, r - half, c - half, cnt + 3 * area);
}
}
}