본문 바로가기

전체 글432

Spring Security Architecture / 스프링 시큐리티 구조 Authentication vs Authorization Authentication the process of validating your credentials (such as User username and password) to verify your identity and whether you are the person you claim to be, or not. Or simply put, Authentication is about knowing who you are. Authorization the process to determine whether the authenticated user has access to a particular resource. Or simply put, Authoriza.. 2023. 11. 20.
[Programmers] Lv.0 / 글자 이어 붙여 문자열 만들기 / Java 문제 풀이 class Solution { public String solution(String my_string, int[] index_list) { String answer = ""; for(int i = 0; i < index_list.length; i ++) { answer += my_string.charAt(index_list[i]); } return answer; } } class Solution { public String solution(String my_string, int[] index_list) { StringBuilder sb = new StringBuilder(); for (int idx : index_list) sb.append(my_string.charAt(idx)); retur.. 2023. 11. 20.
[Programmers] Lv.0 / 주사위 게임 3 / Java 문제 풀이 import java.util.*; class Solution { public int solution(int a, int b, int c, int d) { Map map = new HashMap(); for (int data : new int[] {a, b, c, d}) { if (map.containsKey(data)) map.put(data, map.get(data) + 1); else map.put(data, 1); } PriorityQueue pq = new PriorityQueue(); for (int key : map.keySet()) { pq.add(new Dice(key, map.get(key))); } int answer = 0; if (pq.size() == 1) answer.. 2023. 11. 14.
Spring Bean Life Cycle / 스프링 빈 생명주기 What is a Spring Bean? A Spring bean is a Java object managed by the Spring IoC container. Why Understand the Spring Bean Life Cycle? A solid grasp of the bean life cycle empowers you to effectively manage resources, configure beans, and ensure proper initialization and cleanup. With this knowledge, you can optimize your application’s performance, prevent memory leaks, and implement custom logic.. 2023. 11. 7.
[Programmers] Lv.0 / 간단한 논리 연산 / Java 문제 풀이 class Solution { public boolean solution(boolean x1, boolean x2, boolean x3, boolean x4) { boolean answer = false; if((x1 || x2) && (x3 || x4)) answer = true; return answer; } } class Solution { public boolean solution(boolean x1, boolean x2, boolean x3, boolean x4) { boolean answer = (x1 || x2) && (x3 || x4)); return answer; } } 출처 https://school.programmers.co.kr/learn/courses/30/lessons.. 2023. 11. 7.
[Programmers] Lv.0 / 배열 만들기 4 / Java 문제 풀이 import java.util.*; class Solution { public int[] solution(int[] arr) { List temp = new ArrayList(); int i = 0; while(i = arr[i]) { temp.remove(temp.size() - 1); } } } } int[] stk = new int[temp.size()]; .. 2023. 10. 19.
[Programmers] Lv.0 / 콜라츠 수열 만들기 / Java 문제 풀이 import java.util.*; class Solution { public int[] solution(int n) { List list = new ArrayList(); while(n != 1) { if(n % 2 == 0) { list.add(n); n = n / 2; } else { list.add(n); n = 3 * n + 1; } } list.add(1); return list.stream().mapToInt(i -> i).toArray(); } } import java.util.stream.IntStream; class Solution { public int[] solution(int n) { return IntStream.concat( IntStream.iterate(n, i .. 2023. 10. 19.
[Programmers] Lv.0 / 카운트 업 / Java 문제 풀이 import java.util.*; class Solution { public int[] solution(int start_num, int end_num) { int size = end_num - start_num + 1; int[] answer = new int[size]; for(int i = 0; i < size; i++) { answer[i] = start_num++; } return answer; } } import java.util.stream.IntStream; class Solution { public int[] solution(int start, int end) { // slower ver. return IntStream.rangeClosed(start, end).toArray.. 2023. 10. 19.
[Programmers] Lv.0 / 배열 만들기 2 / Java 문제 풀이 import java.util.*; class Solution { public int[] solution(int l, int r) { List numList = new ArrayList(); for(int i = l; i i).toArray(); int[] empty = {-1}; return answer.length == 0 ? empty : answer; } } import java.util.ArrayList; class Solution { public int[] solution(int l, int r) { ArrayList list = new ArrayList(); for (int i = 1; i < 64; i++) { int num = Integer.parseInt(Integer.toB.. 2023. 10. 19.
[Programmers] Lv.0 / 수열과 구간 쿼리 4 / Java 문제 풀이 import java.util.*; class Solution { public int[] solution(int[] arr, int[][] queries) { for(int i = 0; i < queries.length; i++) { int s = queries[i][0]; int e = queries[i][1]; int k = queries[i][2]; for(int j = s; j 2023. 10. 19.
[Programmers] Lv.0 / 수열과 구간 쿼리 2 / Java 문제 풀이 import java.util.ArrayList; import java.util.Arrays; class Solution { public int[] solution(int[] arr, int[][] queries) { int[] answer = new int[queries.length]; Arrays.fill(answer, -1); for (int i = 0; i < queries.length; i++) { int s = queries[i][0]; int e = queries[i][1]; int k = queries[i][2]; int minGreaterValue = Integer.MAX_VALUE; for (int j = s; j k && arr[j] < minGreaterValue) { m.. 2023. 10. 18.
[Programmers] Lv.0 / 수열과 구간 쿼리 3 / Java 문제 풀이 class Solution { public int[] solution(int[] arr, int[][] queries) { int temp; for(int i = 0; i < queries.length; i++) { temp = arr[queries[i][0]]; arr[queries[i][0]] = arr[queries[i][1]]; arr[queries[i][1]] = temp; } return arr; } } import java.util.Arrays; class Solution { public int[] solution(int[] arr, int[][] queries) { int[] answer = Arrays.copyOf(arr, arr.length); for (int[] query .. 2023. 10. 18.