일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
- 안드로이드
- 폐CT
- 경력 개발자
- 방사성 동위원소 치료
- 동위원소치료
- 입원
- 갑상선암
- 수술
- firebase
- 카페
- 프로그래머스
- 용인세브란스병원
- 임파선전이
- 맛집
- 객체
- 이직 준비
- 알고리즘
- MYSQL
- leetcode
- Android
- 방사성동위원소치료
- 정렬 알고리즘
- 저요오드식
- 갑상선암용인세브란스
- 입원준비
- 월간 코드 챌린지 시즌1
- 백준알고리즘
- 전이
- java
- 림프절전이
- Today
- Total
목록leetcode (18)
새우버거의 개발 블로그

LeetCode # 455 Example 1: Input: g = [1,2,3], s = [1,1] Output: 1 Explanation: You have 3 children and 2 cookies. The greed factors of 3 children are 1, 2, 3. And even though you have 2 cookies, since their size is both 1, you could only make the child whose greed factor is 1 content. You need to output 1. Example 2: Input: g = [1,2], s = [1,2,3] Output: 2 Explanation: You have 2 children and 3 ..

LeetCode # 561 Example 1: Input: nums = [1,4,3,2] Output: 4 Explanation: All possible pairings (ignoring the ordering of elements) are: 1. (1, 4), (2, 3) -> min(1, 4) + min(2, 3) = 1 + 2 = 3 2. (1, 3), (2, 4) -> min(1, 3) + min(2, 4) = 1 + 2 = 3 3. (1, 2), (3, 4) -> min(1, 2) + min(3, 4) = 1 + 3 = 4 So the maximum possible sum is 4. Example 2: Input: nums = [6,2,6,5,1,2] Output: 9 Explanation: T..

LeetCode # 441 Example 1: Input: n = 5 Output: 2 Explanation: Because the 3rd row is incomplete, we return 2. Example 2: Input: n = 8 Output: 3 Explanation: Because the 4th row is incomplete, we return 3. Note: 1

LeetCode # 989 Example 1: Input: num = [1,2,0,0], k = 34 Output: [1,2,3,4] Explanation: 1200 + 34 = 1234 Example 2: Input: num = [9,9,9,9,9,9,9,9,9,9], k = 1 Output: [1,0,0,0,0,0,0,0,0,0,0] Explanation: 9999999999 + 1 = 10000000000 Constraints: 1 = 0 || sum > 0) { if (i >= 0) sum += (num[i]); list.addFirst(sum % 10); sum /= 10; i--; } return list; } } Result #2 💡 ArrayList에서 LinkedList로 자료형 변경 L..

LeetCode # 415 Given two non-negative integers, num1 and num2 represented as string, return the sum of num1 and num2 as a string. Example 1: Input: num1 = "11", num2 = "123" Output: "134" Constraints: 1

LeetCode # 258 Given an integer num, repeatedly add all its digits until the result has only one digit, and return it. Example 1: Input: num = 38 Output: 2 Explanation: The process is 38 --> 3 + 8 --> 11 11 --> 1 + 1 --> 2 Since 2 has only one digit, return it. Constraints: 0 9 && num == 0) { num = sum; sum = 0; } } return sum; } } Result #1 More Algorithm! 👇👇 github.com/ggujangi/ggu.leet-code g..

LeetCode # 67 Given two binary strings a and b, return their sum as a binary string. Example 1: Input: a = "11", b = "1" Output: "100" Constraints: 1 = 0) { result += Math.pow(2, s.length() - 1 - i) * (s.charAt(i) - 48); i--; } return result; } } Result #1 💡 2진수를 10진수로 변환하는 방법은 틀렸다. 가장 직관적으로 생각할 수 있는 방법은 2진수를 10진수로, 10진수를 2진수로 변환하여 풀이하는 것이다. 하지만 이 방법은 틀렸다. 자료형의 범위때문에 잘못된 값이 출력된다. Solution #2 cla..

LeetCode # 717 Example 1: Input: bits = [1, 0, 0] Output: True Explanation: The only way to decode it is two-bit character and one-bit character. So the last character is one-bit character. Example 2: Input: bits = [1, 1, 1, 0] Output: False Explanation: The only way to decode it is two-bit character and one-bit character. So the last character is one-bit character. Note: 1

LeetCode # 953 Example 1: Input: words = ["hello","leetcode"], order = "hlabcdefgijkmnopqrstuvwxyz" Output: true Explanation: As 'h' comes before 'l' in this language, then the sequence is sorted. Example 2: Input: words = ["word","world","row"], order = "worldabcefghijkmnpqstuvxyz" Output: false Explanation: As 'd' comes after 'l' in this language, then words[0] > words[1], hence the sequence i..

LeetCode # 874 Example 1: Input: commands = [4,-1,3], obstacles = [] Output: 25 Explanation: The robot starts at (0, 0): 1. Move north 4 units to (0, 4). 2. Turn right. 3. Move east 3 units to (3, 4). The furthest point away from the origin is (3, 4), which is 32 + 42 = 25 units away. Solution #1 (11ms) import java.awt.*; import java.util.HashSet; import java.util.Set; class Solution { int[] xSt..