본문 바로가기

Algorithm100

[프로그래머스] Lv.2 피로도 https://school.programmers.co.kr/learn/courses/30/lessons/87946 프로그래머스코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요.programmers.co.kr  사용 알고리즘백트래킹DFS 풀이 class Solution { static boolean [] visited; static int answer = 0; public int solution(int k, int[][] dungeons) { visited = new boolean[k]; dfs(k, dungeons, visited, 0); return.. 2024. 6. 11.
[프로그래머스] Lv.2 전력망을 둘로 나누기 https://school.programmers.co.kr/learn/courses/30/lessons/86971 프로그래머스코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요.programmers.co.kr 사용 알고리즘완전 탐색그래프 탐색BFS풀이 import java.util.*;class Solution { static List> graph = new ArrayList(); static boolean[] visited; static int min = Integer.MAX_VALUE; public int solution(int n, int[][] wires) { in.. 2024. 6. 11.
[백준] Gold V. 암호만들기 https://www.acmicpc.net/problem/1759 사용 알고리즘 DFS백트래킹 풀이 import java.io.BufferedReader;import java.io.IOException;import java.io.InputStreamReader;import java.util.*;public class Main { static int l, c; static char [] arr; static boolean [] visited; static List res = new ArrayList(); public static void main(String[] args) throws IOException { BufferedReader br = new Buffered.. 2024. 6. 10.
[프로그래머스] Lv.3 베스트 앨범 사용 알고리즘해쉬 풀이 기존에 제출해서 틀린 풀이import java.util.*;class Solution { // 1. 장르의 플레이 타임 총합을 맵에 담아서 많이 재생된 순서로 정렬한다. public int[] solution(String[] genres, int[] plays) { Map genreMap = new HashMap(); Map indexMap = new HashMap(); for(int i = 0; i totalPlays = new ArrayList(genreMap.values()); Collections.sort(totalPlays, Collections.reverseOrder.. 2024. 6. 10.