일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | |||||
3 | 4 | 5 | 6 | 7 | 8 | 9 |
10 | 11 | 12 | 13 | 14 | 15 | 16 |
17 | 18 | 19 | 20 | 21 | 22 | 23 |
24 | 25 | 26 | 27 | 28 | 29 | 30 |
31 |
- 습작
- 이진수 변환
- PYTHON
- 점프 투 파이썬
- 참조 변수
- 집 값 예측 분석
- jdbc
- Do_it
- MacOS
- 프로그래머스
- 순열
- 2BPerfect
- sql
- 박스그래프
- Do it
- mysql
- 타입 변수
- 브라우저 실행
- 자바
- np.zeros_like
- BFS
- 백준
- Extended Slices
- 팩토리얼 진법
- 이것이 취업을 위한 코딩테스트다
- DFS
- java
- matplotlib
- dacon
- 다익스트라 알고리즘
- Today
- Total
목록Development/CodingTest (34)
🦕 공룡이 되자!
import java.util.*; class Solution { public static int[] solution(int[] answers) { int[][] patterns = { {1, 2, 3, 4, 5}, {2, 1, 2, 3, 2, 4, 2, 5}, {3, 3, 1, 1, 2, 2, 4, 4, 5, 5} }; int[] hit = new int[3]; for(int i = 0; i < hit.length; i++) { for(int j = 0; j < answers.length; j++) { if(patterns[i][j % patterns[i].length] == answers[j]) hit[i]++; } } int max = Math.max(hit[0], Math.max(hit[1], h..
기존에는 queue를 array리스트로 어떻게든 풀었는데 그걸 쓰지 않고서는 너무 복잡하게 코드가 짜여져서 시간이 많이 걸렸다. 아래는 queue를 이용한 해답이다. import java.util.LinkedList; import java.util.Queue; import java.util.List; import java.util.ArrayList; public class Truck { int w; int d; public Truck(int w, int d) { this.w = w; this.d = d; } } class Solution { public int solution(int bridge_length, int weight, int[] truck_weights) { int wL = weight; i..
import java.util.ArrayList; class Solution { public int[] solution(int[] progresses, int[] speeds) { ArrayList aanswer = new ArrayList(); ArrayList ll = new ArrayList(); int cnt=0; for(int i=0; i
class Solution { public int[] solution(int[] prices) { int[] answer = new int[prices.length]; for (int i = 0; i < prices.length; i++) { int cnt = 0; for (int j = i + 1; j < prices.length; j++) { if (i == prices.length - 1) { cnt = 0; break; } else if (prices[i] prices[j]) { cnt++; break; } } answer[i] = cnt; } return answer; } } 리턴되는 횟수를 cnt라고 지정을하고 1초 뒤의 가격과 비교하여 cnt를 측정했다. 조금 더 간단히 하려면 cnt를 없애..