전체 글
-
[프로그래머스] [카카오 인턴] 보석 쇼핑 - 자바(JAVA)알고리즘/프로그래머스 2022. 6. 2. 00:01
https://programmers.co.kr/learn/courses/30/lessons/67258 코딩테스트 연습 - 보석 쇼핑 ["DIA", "RUBY", "RUBY", "DIA", "DIA", "EMERALD", "SAPPHIRE", "DIA"] [3, 7] programmers.co.kr 문제 해석 어피치는 쇼핑을 하면 매장 진열대의 특정 범위의 물건을 모두 구매합니다. 어피치는 진열된 모든 종류의 보석을 적어도 1개 이상 포함하는 가장 짧은 구간을 찾아서 구매하고 싶었습니다. 문제 풀이 전 설계 gems 배열의 크기는 10만입니다. 투포인터 문제 같습니다. 포인터 2개를 0부터 시작하여 오른쪽포인트를 오른쪽으로 이동시킵니다. 이때 오른쪽포인터를 이동시킵니다. (모든 보석을 1개이상 포함하는 구..
-
Git 특정파일 히스토리 삭제Git 2022. 6. 1. 23:18
비밀번호 , DB 정보 등 보안에 취약한 정보가 Repository에 공유되었을 때 어떻게 해야 할까요? 빠르게 해당 정보를 수정하게 되더라도 Commit 내역에 수정됨이 기록됩니다. 이렇게 되면 그대로 소중한 정보가 노출되는데 어떻게 해결해야 할까요? 다음은 Git 특정 파일 히스토리를 삭제하는 명령어입니다. git filter-branch -f --index-filter 'git rm --cached --ignore-unmatch 삭제하고자하는 file명' --prune-empty -- --all 이때 만약에 에러가 발생한다면 unstaged된 파일들이 있는지 commit 되지 않은 파일들이 있는지 확인하여 push 해주어야 합니다. 해당 명령어를 통해서 강제 push 를 하게 되면 remote 역시..
-
DB 옵티마이저와 실행계획CS/데이터베이스 2022. 6. 1. 21:48
옵티마이저(Optimizer)란? 가장 효율적인 방법으로 SQL을 수행할 최적의 처리 경로를 생성해주는 DBMS의 핵심 엔진입니다. 컴퓨터의 두뇌가 CPU라면 DBMS의 두뇌는 옵티마이저입니다. 만약 개발자가 SQL을 작성하고 실행하면 옵티마이저는 쿼리문을 어떻게 실행시키기 위하여 실행계획을 세우게 됩니다. 실행계획을 세운 뒤 시스템 통계정보를 활용하여 각 실행계획의 예상 비용을 산정한 후 각 실행계획을 비교해서 최고의 효율을 가지고 있는 실행계획을 판별한 후 해당 쿼리를 수행합니다. 옵티마이저가 하는 일을 요약하자면 다음과 같습니다. 1. 여러 가지 실행계획을 세운다. 2. 실행계획들을 비교하여 최적의 상황을 찾는다. 규칙 기반 옵티마이저 인덱스의 유무, SQL에서 사용하는 연산자 등을 고려하여 우선순..
-
[백준] 2461번 : 대표 선수 - 자바(JAVA)알고리즘/백준 2022. 6. 1. 00:01
https://www.acmicpc.net/problem/2461 2461번: 대표 선수 입력의 첫 번째 줄에는 학급의 수를 나타내는 N과 각 학급의 학생의 수를 나타내는 M이 하나의 빈칸을 사이에 두고 주어진다. 단, 1 ≤ N, M ≤ 1,000이다. 두 번째 줄부터 N개의 줄에는 각 줄마다 한 www.acmicpc.net 문제 해석 N개의 학급이 존재하며 각 학급의 학생 수는 모두 M명으로 구성됩니다. 각각의 반에서 대표로 선발된 모든 학생들의 능력치 중 최댓값과 최솟값의 차이가 최소가 되도록 선수를 선발하려고 합니다. 예를 들어 N=3, M=4인 경우 학생들의 능력치와 다음과 같이 주어졌습니다. 1반=[12, 16, 67, 43] 2반=[7, 17, 68, 48] 3반=[14, 15, 77, 54..
-
API 문서화를 위한 Swagger와 Spring Rest Docs 비교프로젝트/게시판 프로젝트 2022. 5. 31. 22:43
Swagger란? API 문서를 자동으로 만들어주는 라이브러리입니다. REST API를 편리하게 문서화해주고, 이를 통해 편리하게 API를 호출해보고 테스트할 수 있는 프로젝트입니다. 이를 활용하여 협업하는 클라이언트 개발자에게도 Swagger 만 전달해주면 API Path와 Request , Response 값 및 제약 등을 한 번에 알려줄 수 있습니다. Swagger 예시 글로만 보면 이해하기 어려울 수 있기 때문에 실제로 예시를 보여드리겠습니다. 아래의 사이트에서 직접 활용해볼 수 있습니다. https://petstore.swagger.io/?_ga=2.58706851.880875351.1654000882-1005427767.1652498303 Swagger UI petstore.swagger.io..
-
테스트 코드 리팩토링하기프로젝트/게시판 프로젝트 2022. 5. 31. 01:24
기존의 테스트 코드에는 매번 테스트를 위해 MemberRequestDTO를 만들어줬습니다. 결국에는 계속 중복되는 로직이 발생하였고 만약 요구사항의 변경으로 Entity가 변경된다면 모든 코드를 수정해줘야 하는 불편함도 겪었습니다. 따라서 매번 중복적으로 만들어주는 부분을 메서드로 뽑아 유지보수성과 가독성을 올리고자 합니다. 기존 코드 @Test @DisplayName("회원 가입 정상 로직") public void memberNotDuplicateTest() { //given MemberRequestDTO memberRequestDTO = MemberRequestDTO.builder() .userId("Test") .name("Test") .nickName("Test") .password("Test")..
-
[백준] 2573번 : 빙산 - 자바(JAVA)알고리즘/백준 2022. 5. 31. 00:01
https://www.acmicpc.net/problem/2573 2573번: 빙산 첫 줄에는 이차원 배열의 행의 개수와 열의 개수를 나타내는 두 정수 N과 M이 한 개의 빈칸을 사이에 두고 주어진다. N과 M은 3 이상 300 이하이다. 그 다음 N개의 줄에는 각 줄마다 배열의 각 행을 www.acmicpc.net 문제 해석 각 빙산의 부분별 높이 정보는 배열의 각 칸에 양의 정수로 저장됩니다. 빙상 이외에 바다에 해당하는 칸에는 0이 저장됩니다. 빙산의 높이는 바닷물에 많이 접해져 있는 부분부터 빨리 줄어듭니다. 배열에서 빙산의 각 부분에 해당되는 칸에 있는 높이는 일년마다 각 칸에 동서남북 4 방향으로 붙어 있는 0이 저장된 캉의 개수만큼 줄어듭니다. 그림1의 빙산은 1년후에 그림 2와 같이 변형됩..
-
HTTP 1.1 , HTTP 2.0, HTTP 3.0 정리CS/네트워크 2022. 5. 30. 00:04
카카오는 어떤 프로토콜을 사용하고 있을지 궁금하여 개발자 도구를 열고 찾아보았습니다. http1.1, h2, h3를 사용하고 있는데 이 프로토콜이 어떤 것들인지 알아보도록 하겠습니다. HTTP란? Hyper Text Transfer Protocol으로 HTML을 전송하기 위한 통신 규약이지만 현재는 모든 것을 HTTP로 전송하고 있습니다. 웹상에서 클라이언트와 서버가 서로 정보를 주고 받을 수 있도록 하는 규약입니다. 만약 HTTP가 무엇인지 잘 모른다면 다음글을 보고 오시면 좋을 것 같습니다. https://junuuu.tistory.com/36?category=974977 HTTP 기본 HTTP란? HyperText Transfer Protocol의 약자로 HTML을 전송하는 프로토콜로 시작되었으나 ..