Algorithms/Java 56

99클럽 코테 스터디 36일차 TIL + 도미노 (java)

💡 문제도미노https://www.acmicpc.net/problem/1552권장 시간1시간 30분소요 시간1시간 30분 + a나의 풀이 코드import java.io.*;public class BOJ1552 { int[][] map; int N; int maxScore = Integer.MIN_VALUE; int minScore = Integer.MAX_VALUE; // permutation에서 생성된 순열로 점수 계산 private void calculate(int[] perm) { boolean[] isVisited = new boolean[N]; int score = 1; // 현재 순열에 대한 점수 (곱하기니까 초기값은 1) ..

Algorithms/Java 2024.08.26

99클럽 코테 스터디 32일차 TIL + 아이템 줍기 (java)

💡 문제아이템 줍기https://school.programmers.co.kr/learn/courses/30/lessons/87694권장 시간1시간 30분소요 시간1시간 30분 + a나의 풀이 코드import java.util.*;class Rectangle { int x1, y1, x2, y2; public Rectangle(int x1, int y1, int x2, int y2) { this.x1 = x1; this.y1 = y1; this.x2 = x2; this.y2 = y2; } // 주어진 좌표(x, y)가 사각형 내부에 있는지 확인 public boolean isIn(int x, int y) { if (..

Algorithms/Java 2024.08.23

99클럽 코테 스터디 30일차 TIL + Minimum Operations to Make a Subsequence (java)

💡 문제Minimum Operations to Make a Subsequencehttps://leetcode.com/problems/minimum-operations-to-make-a-subsequence/권장 시간1시간 30분소요 시간1시간 30분 + a 나의 풀이 코드import java.util.*;class Solution { public int minOperations(int[] target, int[] arr) { // target의 위치 저장 Map map = new HashMap(); for (int i = 0; i list = new ArrayList(); for (int num : arr) { if (map...

Algorithms/Java 2024.08.20

99클럽 코테 스터디 26일차 TIL + 개인정보 수집 유효기간 (java)

💡 문제개인정보 수집 유효기간https://school.programmers.co.kr/learn/courses/30/lessons/150370권장 시간1시간 30분소요 시간1시간 15분 나의 풀이 코드import java.util.*;class Solution { StringTokenizer st; public int[] solution(String today, String[] terms, String[] privacies) { // String -> int st = new StringTokenizer(today, "."); int year = Integer.parseInt(st.nextToken()) - 2000; // 20 ..

Algorithms/Java 2024.08.16

99클럽 코테 스터디 24일차 TIL + 가장 먼 노드 (java)

💡 문제가장 먼 노드https://school.programmers.co.kr/learn/courses/30/lessons/49189#권장 시간1시간소요 시간1시간 30분 + a 나의 풀이 코드import java.util.*;public class Edge { int start; int end; public Edge(int start, int end) { this.start = start; this.end = end; }}class Solution { public int solution(int n, int[][] edge) { int answer = 0; // 인접리스트 초기화 ArrayList> ..

Algorithms/Java 2024.08.14

99클럽 코테 스터디 21일차 TIL + 정수 삼각형 (java)

💡 문제정수 삼각형https://school.programmers.co.kr/learn/courses/30/lessons/43105권장 시간1시간 30분소요 시간50분나의 풀이 코드class Solution { public int solution(int[][] triangle) { int answer = 0; for (int i = 1; i 주요사항DP 문제는 처음 풀어봤는데 생각보다 재밌었다!규칙이 확실하게 있는게 좋달까..근데 프로그래머스에서 채점하면 정확성 64.3 / 효율성 35.7로 너무 낮게 나와서 어떻게 개선할 수 있을지 고민… 나중에 알고 스터디하면 물어봐야겠다.Ref.동적계획법(Dynamic Programming)

Algorithms/Java 2024.08.12