목록알고리즘/[2021] 프로그래머스 (8)
알맹이방
import java.util.Arrays; import java.util.ArrayList; class Solution { public int[] solution(int[] answers) { int num1_cnt =0; int num2_cnt =0; int num3_cnt =0; int num1=0; int[] list1 = {1,2,3,4,5}; for(int i = 0; i
import java.util.ArrayList; import java.util.Collections; class Solution { ArrayList answers = new ArrayList(); void dfs(String begin, String[][]tickets, int count, String answer, boolean[]visited){ if(count==tickets.length){ answers.add(answer); return; } for(int i = 0; i
class Solution { static int sum_count = Integer.MAX_VALUE; //최솟값을 찾기 위한 count void dfs(boolean[] visited, String target, String[] words, String begin, int count){ //target 이라면 count가 sum_count보다 작으면 갱신해줌 if(begin.equals(target)){ if(sum_count>count){ sum_count=count; } return ; } for(int i = 0; i