➜ 코딩 테스트/기타

제로베이스 과제 - 콘솔 화면에 구구단 출력하기

public class HomeWork1 { public static void main(String[] args){ /** * * 강명석 * */ System.out.println("[구구단 출력]"); for(int i = 1; i

➜ 코딩 테스트/프로그래머스

프로그래머스 - 수열과 구간 쿼리 2

class Solution { public int[] solution(int[] arr, int[][] queries) { int[] answer = new int[queries.length]; for (int i = 0; i k) { min = Math.min(min, arr[j]); check = true; } } if(check){ answer[i] = min;..

➜ 코딩 테스트/프로그래머스

프로그래머스 - 수열과 구간 쿼리 3

class Solution { public int[] solution(int[] arr, int[][] queries) { for(int i = 0; i < queries.length; i++){ int[] query = queries[i]; int a = query[0]; int b = query[1]; int temp = arr[a]; arr[a] = arr[b]; arr[b] = temp; } return arr; } }

카테고리 없음

프로그래머스 - 수 조작하기 2

class Solution { public String solution(int[] numLog) { String answer = ""; String[] str = new String[numLog.length -1]; for(int i = 0; i < numLog.length -1; i++){ str[i] = ""; if(numLog[i+1] == numLog[i] + 1){ str[i] += 'w'; }else if(numLog[i + 1] == numLog[i] -1){ str[i] += 's'; }else if(numLog[i +1] == numLog[i] + 10){ str[i] += 'd'; }else if(numLog[i+1] == numLog[i] - 10){ str[i] += 'a'; } }..

➜ 코딩 테스트/프로그래머스

프로그래머스 - 수 조작하기1

class Solution { public int solution(int n, String control) { int answer = 0; String[] controlarr = new String[control.length()]; for(int i = 0; i < control.length(); i++){ controlarr[i] = String.valueOf(control.charAt(i)); } for(int j = 0; j < control.length(); j++){ if(controlarr[j].equals("w")){ n += 1; }else if(controlarr[j].equals("s")){ n -= 1; }else if(controlarr[j].equals("d")){ n += 10;..

➜ 코딩 테스트/프로그래머스

프로그래머스 - 마지막 두 원소

class Solution { public static int[] solution(int[] num_list) { int[] result = new int[0]; if(num_list.length > 1) { int last = num_list[num_list.length - 1]; int prev = num_list[num_list.length - 2]; if (last > prev) { result = new int[num_list.length + 1]; System.arraycopy(num_list, 0, result, 0, num_list.length); result[num_list.length] = last - prev; } else { result = new int[num_list.length..

➜ Spring

Spring Data JPA : Projection에 대해서

Spring Data JPA에서 중요한 개념 중 하나인 'Projection'에 대해서 공부를 하고 작성해 본다 Projection 어노테이션은 Spring Data REST에서 제공하는 기능으로, 특정 리소스의 표현을 커스터마이징 할 때 사용한다. 이 어노테이션을 활용하면 엔티티의 일부 필드를 추출하거나, 필드를 합치거나, 복잡한 값을 단순화하는 등의 작업을 할 수 있다. 이를 통해 API 응답에 특정 형태의 데이터를 제공하도록 커스텀 뷰를 정의할 수 있다. @Projection 어노테이션에는 위에 사진처럼 'name'과 'types'이라는 속성이 있다. 'name' : 프로젝션의 이름이다. 이 이름은 클라이언트가 API 호출 시 URL에 사용하여 특정 프로젝션을 요청할 수 있다. 'types' : 프..

➜ 코딩 테스트/프로그래머스

프로그래머스 - n보다 커질 때까지 더하기

class Solution { public int solution(int[] numbers, int n) { int answer = 0; int sum = 0; for(int i = 0; i n){ answer = sum; break; } } return answer; } }

➜ 코딩 테스트/프로그래머스

프로그래머스 - 문자열로 변환

class Solution { public String solution(int n) { String answer = ""; answer = Integer.toString(n); return answer; } }

➜ 코딩 테스트/프로그래머스

프로그래머스 - 부분 문자열인지 확인하기

class Solution { public int solution(String my_string, String target) { if(my_string.contains(target)) { return 1; }else{ return 0; } } }

강맹석
맹석의 IT노트 & 일상 기록