내가 짠 코드(통과) import java.util.ArrayList; import java.util.Collections; import java.util.Comparator; import java.util.List; class Solution { public int solution(int[][] jobs) { int answer = 0; //첫 작업을 찾고 (중복이면 여러개 찾아야함) List jobList=new ArrayList(); for (int i = 0; i < jobs.length; i++) { jobList.add(new Job(jobs[i][0], jobs[i][1])); } int size=jobList.size(); Collections.sort(jobList); //작업이 진행되지..
class Solution { public int solution(int[][] triangle) { int answer = 0; //up left = i-1, up right= 1, //dp[n][k][0] , dp[n][k][1]중에 최대를 dp[n+1][k][1], n,k-1에서 최대를 dpn k 0로 .. int[][][] dp=new int[triangle.length+1][triangle.length+1][2]; dp[0][0][0]=dp[0][0][1]=triangle[0][0]; for (int i = 1; i < triangle.length; i++) { dp[i][0][0]=0; dp[i][0][1]=Math.max(dp[i-1][0][0],dp[i-1][0][1])+triangle[i..
class Solution { public int solution(int n, int s, int a, int b, int[][] fares) { int answer = Integer.MAX_VALUE; int[][] nodeFare=new int[n+1][n+1]; for(int i=1;i
class Solution { static boolean[][] areaFlag; static int[][] pictureGrid; static int height,width; public int[] solution(int m, int n, int[][] picture) { int numberOfArea = 0; int maxSizeOfOneArea = 0; height=m; width=n; pictureGrid = picture.clone(); areaFlag=new boolean[m][n]; for (int i = 0; i < m; i++) { for (int j = 0; j < n; j++) { if(!areaFlag[i][j]&&picture[i][j]!=0){ //검사되지 않은 영역을 대상으로 ..
95/100 코드 class Solution { public long solution(int cap, int n, int[] deliveries, int[] pickups) { int ep=getEndPoint(n-1, deliveries, pickups); long answer=0; int startIdx=0; while (true){ if(ep=startIdx;i--){ //int idx=ep-i+startIdx; // 1회차:0 2회차:1 if(deliveries[i]!=0){ //해당 집의 배달이 완료되지 않은 경우. if(load>0){ int leftDelivery=deliveries[i]; if(load0){ int leftPick=pickups[i]; if(leftPickUp 새로운 검사 ..
import java.util.*; class Solution { Set passedWaySet =new HashSet(); String[] targetGrid; public int[] solution(String[] grid) { List ansList=new ArrayList(); targetGrid=grid.clone(); for (int i = 0; i < grid.length; i++) { for (int j = 0; j < grid[i].length(); j++) { Way down = new Way(i, j, 'D'); Way up = new Way(i, j, 'U'); Way right = new Way(i, j, 'R'); Way left = new Way(i, j, 'L'); //지나간..