일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
- 백준알고리즘
- 방사성 동위원소 치료
- 임파선전이
- 전이
- 경력 개발자
- java
- Android Compose
- firebase
- 갑상선암용인세브란스
- 수술
- MYSQL
- 안드로이드
- 알고리즘
- 맛집
- Compose
- 저요오드식
- 카페
- 갑상선암
- leetcode
- 입원
- 동위원소치료
- 객체
- Android
- 림프절전이
- 용인세브란스병원
- 정렬 알고리즘
- 폐CT
- 프로그래머스
- Jetpack Compose
- 방사성동위원소치료
- Today
- Total
목록프로그래머스 - JAVA/Level 2 (14)
새우버거의 개발 블로그
예제: A B answer [1, 4, 2] [5, 4, 4] 29 [1, 2 [3, 4] 10 제한 조건: 배열 A, B의 크기 : 1,000 이하의 자연수 배열 A, B의 원소의 크기 : 1,000 이하의 자연수 Solution #1 import java.util.Arrays; class Solution { public int solution(int[] A, int[] B) { int answer = 0; Arrays.sort(A); Arrays.sort(B); for (int i = 0; i < A.length; i++) { answer += A[i] * B[B.length - i - 1]; } return answer; } } Result #1 More Algorithm! 👇👇 github.com..
예제: arr1 arr2 return [[1, 4], [3, 2], [4, 1]] [[3, 3], [3, 3]] [[15, 15], [15, 15], [15, 15]] [[2, 3, 2], [4, 2, 4], [3, 1, 4]] [[5, 4, 3], [2, 4, 1], [3, 1, 1]] [[22, 22, 11], [36, 28, 18], [29, 20, 14]] Solution #1 class Solution { public int[][] solution(int[][] arr1, int[][] arr2) { int[][] answer = new int[arr1.length][arr2[0].length]; for (int i = 0; i < arr1.length; i++) { // arr1 아래로 for..
예제: arr result [2, 6, 8, 14] 168 [1, 2, 3] 6 Solution #1 class Solution { public int solution(int[] arr) { int answer = arr[0]; for (int i = 1; i < arr.length; i++) { int gcd = gcd(answer, arr[i]); answer = answer * arr[i] / gcd; } return answer; } private int gcd(int a, int b) { while (b != 0) { int r = a % b; a = b; b = r; } return a; } } Result #1 More Algorithm! 👇👇 github.com/ggujangi/ggu.pr..
예제: s return "3people unFollowed me" "3people Unfollowed Me" "for the last week" "For The Last Week" Solution #1 class Solution { public String solution(String s) { StringBuilder answer = new StringBuilder(); boolean isBlank = true; s = s.toLowerCase(); for (char c : s.toCharArray()) { if (c == ' ') { isBlank = true; answer.append(c); } else if (isBlank && (c >= 'a' && c