본문 바로가기
728x90

Language/Java144

[Programmers | Java | 월간 코드 챌린지 시즌2 문제 풀이] 음양 더하기 - Solution with Loop & If-statement 또는 Stream API KDT 실무형 스프링 백엔드 엔지니어 양성과정 6기 | Algorithm CODEKATA음양 더하기🏷 관련 주제 : Array 반복문 조건문 Boolean✔ Solution with Loop & if-statementclass Solution { public int solution(int[] absolutes, boolean[] signs) { int answer = 0; for (int i = 0; i 채점 결과 ✔ Solution with IntStream & map & sumimport java.util.stream.IntStream;class Solution { public int solution(int[] absolutes, boolean[] sig.. 2024. 6. 22.
[LeetCode | Java | Array, Sorting 문제 풀이] 2089. Find Target Indices After Sorting Array - Solution with Loop 또는 Stream API 99 Club 2기 | Java | Beginnerℹ️ 2089. Find Target Indices After Sorting Array🏷 관련 주제 : Array Binary Search SortingEasy✔ Solution with Sorting & Loopimport java.util.Arrays;import java.util.List;import java.util.ArrayList;class Solution { public List targetIndices(int[] nums, int target) { List answer = new ArrayList(); Arrays.sort(nums); for (int i = 0; i 채점 결과✔ Solution .. 2024. 6. 21.
[Programmers | Java | 연습문제 풀이] 나누어 떨어지는 숫자 배열 - Solution with Arrays.copyOf() 또는 Stream API KDT 실무형 스프링 백엔드 엔지니어 양성과정 6기 | Algorithm CODEKATA🔢 나누어 떨어지는 숫자 배열🏷 관련 주제 : 나머지 연산자 배열 복사 배열 자르기 배열 정렬 ✔ Solution with Operator & Arrays.copyOf()import java.util.Arrays;class Solution { public int[] solution(int[] arr, int divisor) { int[] temp = new int[arr.length]; int idx = 0; for (int i = 0; i 채점 결과 ✔ Solution with Stream APIimport java.util.Arrays;class Solu.. 2024. 6. 20.
[Programmers | Java | 연습문제 풀이] 서울에서 김서방 찾기 - Solution with Loop & equals() & String.format() KDT 실무형 스프링 백엔드 엔지니어 양성과정 6기 | Algorithm CODEKATA🧑‍💼 서울에서 김서방 찾기🏷 관련 주제 : Array 인덱스 문자열 비교 ✔ Solution with for-statement & equals() & String.format()class Solution { public String solution(String[] seoul) { String answer = ""; for(int x = 0; x 채점 결과 ✔ Solution with forEach-Statement & equals() & String.format()class Solution { public String solution(String[] seoul) { .. 2024. 6. 19.
[Programmers | Java | 연습문제 풀이] 콜라츠 추측 - Solution with Loop 또는 Recursion KDT 실무형 스프링 백엔드 엔지니어 양성과정 6기 | Algorithm CODEKATA🧐 콜라츠 추측🏷 관련 주제 : 반복문 재귀함수 조건문 연산자✔ Solution with 반복문class Solution { public int solution(long num) { int answer = 0; while (num != 1 && answer = 500) { answer = -1; } return answer; }}채점 결과✔ Solution with 재귀함수class Solution { public int solution(long num) { int answer = 0; if (num % .. 2024. 6. 19.
[Programmers | Java | 연습문제 풀이] 두 정수 사이의 합 - Solution with Loop 또는 Math KDT 실무형 스프링 백엔드 엔지니어 양성과정 6기 | Algorithm CODEKATA➕ 두 정수 사이의 합🏷 관련 주제 : Loop Math 문제 설명두 정수 a, b가 주어졌을 때 a와 b 사이에 속한 모든 정수의 합을 리턴하는 함수, solution을 완성하세요.예를 들어 a = 3, b = 5인 경우, 3 + 4 + 5 = 12이므로 12를 리턴합니다.제한 조건a와 b가 같은 경우는 둘 중 아무 수나 리턴하세요.a와 b는 -10,000,000 이상 10,000,000 이하인 정수입니다.a와 b의 대소관계는 정해져있지 않습니다.입출력 예abreturn35123335312✔ Solution with Loopclass Solution { public long solution(int a, i.. 2024. 6. 17.
[LeetCode | Java | Array, String 문제 풀이] 1773. Count Items Matching a Rule - Solution with Loop 99 Club 2기 | Java | Beginner🚩 1773. Count Items Matching a Rule🏷 관련 주제 : Array StringEasy You are given an array items, where each items[i] = [$type_{i},\ color_{i},\ name_{i}$] describes the type, color, and name of the $i^{th}$ item. You are also given a rule represented by two strings, ruleKey and ruleValue.The $i^{th}$ item is said to match the rule if one of the following is true:ruleKey.. 2024. 6. 17.
[Programmers | Java | 연습문제 풀이] 하샤드 수- Solution with Loop & Arithmetic Operator & Boolean KDT 실무형 스프링 백엔드 엔지니어 양성과정 6기 | Algorithm CODEKATA🔢 하샤드 수🏷 관련 주제 : 반복문 산술 연산자 Boolean문제 설명양의 정수 x가 하샤드 수이려면 x의 자릿수의 합으로 x가 나누어져야 합니다.예를 들어 18의 자릿수 합은 1+8=9이고, 18은 9로 나누어 떨어지므로 18은 하샤드 수입니다.자연수 x를 입력받아 x가 하샤드 수인지 아닌지 검사하는 함수, solution을 완성해주세요.제한 조건 x는 1 이상, 10000 이하인 정수입니다.입출력 예 x return 10 true 12 true 11 false 13 false 입출력 예 설명입출력 예 #110의 모든 .. 2024. 6. 16.
[LeetCode | Java | Array, String 문제 풀이] 2942. Find Words Containing Character - Solution with cotains() 99 Club 2기 | Java | Beginner🈶 2942. Find Words Containing Character🏷 관련 주제 : Array String contains()EasyYou are given a 0-indexed array of strings words and a character x.Return an array of indices representing the words that contain the character x.Note that the returned array may be in any order.Example 1:Input: words = ["leet","code"], x = "e"Output: [0,1]Explanation: "e" occurs in both wor.. 2024. 6. 16.
728x90