no image
[프로그래머스] JadenCase 문자열 만들기
class Solution { public String solution(String s) { String answer = ""; String[] sp = s.split(" "); // 공백을 기준으로 문자열 자르기 // 공백을 기준으로 잘려진 문자열의 수만큼 반복 for(int i = 0; i < sp.length; i++){ if(sp[i].length() == 0) answer += " "; // 단어가 공백일 경우 반환값에 공백 더하기 else{ answer += sp[i].substring(0, 1).toUpperCase(); // 단어 첫번째 대문자로 변환하여 더하기 answer += sp[i].substring(1, sp[i].length()).toLowerCase(); // 첫글자를 제외하고..
2023.03.29
no image
[프로그래머스] 약수의 합 - java
class Solution { public int solution(int n) { int answer = 0; for(int i=1; i
2023.03.29
no image
[프로그래머스] 짝수의 합
class Solution { public int solution(int n) { int answer = 0; for(int i = 2; i
2023.03.27
no image
[프로그래머스] 나이출력-java
class Solution { public int solution(int age) { return 2022-age+1; } } 다른 사람 답 import java.time.*; class Solution { public int solution(int age) { LocalDate today = LocalDate.now(); return today.getYear() - age + 1; } }
2023.03.26
no image
[프로그래머스] 최빈값 구하기-java
class Solution { public int solution(int[] array) { int answer = array[0]; int max = 0; int frequent[] = new int[1000]; for(int i = 0; i 1) answer = -1; } return answer; } } 다..
2023.03.26
no image
[프로그래머스]짝수는 싫어요 - java
import java.util.*; class Solution { public ArrayList solution(int n) { ArrayList answer = new ArrayList(); for(int i=1; i value % 2 == 1).toArray(); } }
2023.03.26
no image
[프로그래머스] 중앙값 구하기-java
import java.util.Arrays; class Solution { public int solution(int[] array) { Arrays.sort(array); return array[array.length/2]; } }
2023.03.26
no image
[프로그래머스] 나머지 구하기
class Solution { public int solution(int num1, int num2) { int answer = num1%num2; return answer; } } https://school.programmers.co.kr/learn/courses/30/lessons/120810
2023.03.26
no image
[프로그래머스] 코딩테스트 입문 DAY-25 문제들
프로그래머스 입문 문제들을 한꺼번에 풀고 싶으신 분들이 있을 거 같아 올린다. 여기에 나온 것들을 수누서대로 풀면 DAY-25이 완성된다.
2023.03.25