250209 회고 💬

오늘(250209) 정보처리기사 필기시험을 보고 왔다. 시험을 제출하면 가채점 결과를 보여주는데, 68점이 나왔다. 오예! 😁 찾아보니 가채점 점수에서 오르면 올랐지 내려가지는 않는다고 그래서 합격권인 듯 하다. 이제는 실기 준비를 해야 한다. 몇 주 내내 한파가 계속돼서 아침에 일어나기가 너무 힘들다. SSAFY 처음 시작할 때만 해도 뭐든 열심히 해서 갓생살겠다 다짐했지만,,, 얼마 못 가 게을러지는 날 보고는 한다. 나란 사람 간사한 사람,,, 여하튼 계속되는 한파로 출근이 싫은 이번 주를 되돌아본다.

Keep 👍

  • 알고리즘 문제 풀이를 계속하고 있다. SSAFY B형 특강으로 알고리즘 강의도 듣고 있다. 이것저것 대회식으로 진도가 나간다. 여기서 아니면 내가 언제 대회식으로 알고리즘 준비를 할 수 있을까 생각하면 강의듣는게 너무 즐겁다. 😚 링크드 리스트, 그래프, 트리를 공부했다.
  • 알고리즘 풀이 후에 테스트코드를 작성해봤다. 평소에 테스트코드 작성하기 어려운 코드는 안 좋은 코드라는 생각을 하고 있다. 그런데 내 풀이 코드가 테스트코드 작성하기 너무 어려운 구조라는걸 이번 기회에 알게 됐다. 그래서 코드 구조를 변경해보려고 이것저것 시도해보는 중이다. 어렵다. 그래도 즐겁다! 🤩
  • 이번 주에는 이것저것 일이 많아서 개인 프로젝트에 시간 할애를 못했다. 그래도 출퇴근 시간에 계속 강의는 듣고 있다.
    - OAuth2
    - 개념
    - GrantType
    - SpringSecurity OAuth2
    - SpringBoot
    - 내장 톰캣
    - 스프링부트 스타터
  • 면접을 위한 CS 전공지식 노트 를 계속 읽고 있다.

Try 🧚

  • SSAFY B형 대비 문제 풀이하기
  • 토이 프로젝트 비디오 업로드 로직 완성
    - 백엔드
    - 개인 프로필 로직 제작
    - 비디오 업로드 로직
    - 비디오 응답 로직
    - 프론트엔드
    - 개인 프로필 화면 제작
    - 비디오 화면 제작

독서 목록

서평 완료 목록

서평 예정 목록 (읽는 중)

  • 면접을 위한 CS 전공지식 노트

독서 예정 목록

  • 오브젝트
  • HTTP 완벽 가이드
  • 자바/스프링 개발자를 위한 실용주의 프로그래밍
  • 모던 자바 인 액션
  • 자바 성능 튜닝 이야기
  • 헤드 퍼스트 서블릿
  • 파이브 라인스 오브 코드

Extras 😀

테스트 코드 작성

원래는 test 코드 디렉토리를 분리해서 관리했다. 그런데 Solution 클래스가 public 클래스가 아니다 보니 사용할 수가 없었다. 그래서 테스트 코드 디렉토리를 제거했다. 그리고 똑같은 패키지에 풀이 로직과 테스트 로직을 같이 위치시켰다. 분리하라고 IDE에서 잔소리를 하지만 더 좋은 방법을 아직은 못 찾았다.

- main.BJ9095
	- SolutionTest.java
	- Main.java
package main.BJ9095;  
  
import org.junit.jupiter.params.ParameterizedTest;  
import org.junit.jupiter.params.provider.CsvSource;  
  
import static org.junit.jupiter.api.Assertions.*;  
  
class SolutionTest {  
  
    @ParameterizedTest(name = "input {0} : expected {1}")  
    @CsvSource({  
          "4, 7",  
          "7, 44",  
          "10, 274"  
    })  
    void test(int input, int expected) {  
  
       // given  
       Solution s = new Solution();  
       int[] expectedArray = {expected}; // Create an array for expected value  
  
       // when  
       int[] result = s.solution(new int[]{input});  
  
       // then  
       assertArrayEquals(expectedArray, result); // Compare arrays  
    }  
}
package main.BJ9095;  
  
import java.io.BufferedReader;  
import java.io.IOException;  
import java.io.InputStreamReader;  
  
public class Main {  
  
    public static void main(String[] args) {  
       new Main().run();  
    }  
  
    private void run() {  
       try (BufferedReader br = new BufferedReader(new InputStreamReader(System.in))) {  
  
          Solution s = new Solution();  
          s.solution(readInput(br));  
          System.out.println(s.getAnswer());  
  
       } catch (IOException e) {  
          throw new RuntimeException(e);  
       }  
    }  
  
    private int[] readInput(BufferedReader br) throws IOException {  
       int len = Integer.parseInt(br.readLine());  
       int[] result = new int[len];  
       for (int i = 0; i < len; i++) {  
          result[i] = Integer.parseInt(br.readLine());  
       }  
       return result;  
    }  
}  
  
class Solution {  
  
    private int[] field;  
    private int[] result;  
  
    public int[] solution(int[] targets) {  
       init(targets);  
  
       result = new int[targets.length]; // Initialize result here  
       for (int i = 0; i < targets.length; i++) {  
          result[i] = field[targets[i]];  
       }  
  
       return result;  
    }  
  
    private void init(int[] targets) {  
       this.field = new int[12];  
       this.result = new int[targets.length];  
       field[1] = 1;  
       field[2] = 2;  
       field[3] = 4;  
       for (int i = 4; i < field.length; i++) {  
          field[i] = field[i - 1] + field[i - 2] + field[i - 3];  
       }  
    }  
  
    public String getAnswer() {  
       StringBuilder answer = new StringBuilder();  
       for (int target : result) {  
          answer.append(target).append("\n");  
       }  
       return answer.toString();  
    }  
}
profile
What doesn't kill you, makes you stronger

0개의 댓글

Powered by GraphCDN, the GraphQL CDN