문자열을 정수로 변환하기
https://school.programmers.co.kr/learn/courses/30/lessons/181848
프로그래머스
코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요.
programmers.co.kr
class Solution {
public int solution(String n_str) {
return Integer.parseInt(n_str);
}
}
n 번째 원소부터
https://school.programmers.co.kr/learn/courses/30/lessons/181892
프로그래머스
코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요.
programmers.co.kr
import java.util.*;
class Solution {
public int[] solution(int[] num_list, int n) {
return Arrays.copyOfRange(num_list,n-1, num_list.length);
}
}
문자열의 뒤의 n글자
https://school.programmers.co.kr/learn/courses/30/lessons/181910
프로그래머스
코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요.
programmers.co.kr
class Solution {
public String solution(String my_string, int n) {
return my_string.substring(my_string.length()-n);
}
}
조건에 맞게 수열 변환하기 1
https://school.programmers.co.kr/learn/courses/30/lessons/181882
프로그래머스
코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요.
programmers.co.kr
class Solution {
public int[] solution(int[] arr) {
for(int i=0; i<arr.length; i++) {
if (arr[i] >= 50 && arr[i] %2 == 0) {
arr[i] /= 2;
} else if (arr[i] < 50 && arr[i] %2 ==1) {
arr[i] *= 2;
}
}
return arr;
}
}
문자열의 앞의 n글자
https://school.programmers.co.kr/learn/courses/30/lessons/181907
프로그래머스
코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요.
programmers.co.kr
class Solution {
public String solution(String my_string, int n) {
return my_string.substring(0,n);
}
}
문자열로 변환
https://school.programmers.co.kr/learn/courses/30/lessons/181845
프로그래머스
코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요.
programmers.co.kr
class Solution {
public String solution(int n) {
return n+"";
}
}
n 번째 원소까지
https://school.programmers.co.kr/learn/courses/30/lessons/181889
프로그래머스
코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요.
programmers.co.kr
import java.util.*;
class Solution {
public int[] solution(int[] num_list, int n) {
return Arrays.copyOfRange(num_list,0,n);
}
}
접두사인지 확인하기
https://school.programmers.co.kr/learn/courses/30/lessons/181906
프로그래머스
코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요.
programmers.co.kr
class Solution {
public int solution(String my_string, String is_prefix) {
int answer = 0;
if (is_prefix.length() < my_string.length()) {
for(int i=0; i<is_prefix.length(); i++) {
if(is_prefix.charAt(i) == my_string.charAt(i)) {
if(i==is_prefix.length()-1) answer = 1;
else continue;
} else break;
}
}
return answer;
}
}
if (my_string.startsWith(is_prefix)) return 1;
이렇게 간단히 할 수 있었다니..............!!!!!!
부분 문자열
https://school.programmers.co.kr/learn/courses/30/lessons/181842
프로그래머스
코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요.
programmers.co.kr
class Solution {
public int solution(String str1, String str2) {
int answer = 0;
if (str2.contains(str1)) answer=1;
return answer;
}
}
정수 부분
https://school.programmers.co.kr/learn/courses/30/lessons/181850
프로그래머스
코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요.
programmers.co.kr
class Solution {
public int solution(double flo) {
int answer = (int) flo;
return answer;
}
}
조건에 맞게 수열 변환하기 3
https://school.programmers.co.kr/learn/courses/30/lessons/181835
프로그래머스
코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요.
programmers.co.kr
class Solution {
public int[] solution(int[] arr, int k) {
int[] answer = new int[arr.length];
for(int i=0; i<arr.length; i++){
if(k%2==1) {
answer[i] = arr[i] * k;
} else {
answer[i] = arr[i] + k;
}
}
return answer;
}
}
대문자로 바꾸기
https://school.programmers.co.kr/learn/courses/30/lessons/181877
프로그래머스
코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요.
programmers.co.kr
class Solution {
public String solution(String myString) {
return myString.toUpperCase();
}
}
소문자로 바꾸기
https://school.programmers.co.kr/learn/courses/30/lessons/181876
프로그래머스
코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요.
programmers.co.kr
class Solution {
public String solution(String myString) {
return myString.toLowerCase();
}
}
배열의 원소만큼 추가하기
https://school.programmers.co.kr/learn/courses/30/lessons/181861
프로그래머스
코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요.
programmers.co.kr
class Solution {
public int[] solution(int[] arr) {
int n = 0;
for(int num : arr) {
n += num;
}
int[] answer = new int[n];
int count = 0;
for(int i=0; i<arr.length; i++){
for(int j=0;j<arr[i]; j++) {
answer[count] = arr[i];
count++;
}
}
return answer;
}
}
정수 찾기
https://school.programmers.co.kr/learn/courses/30/lessons/181840
프로그래머스
코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요.
programmers.co.kr
class Solution {
public int solution(int[] num_list, int n) {
int answer = 0;
for ( int num : num_list) {
if (num == n) {
answer = 1;
break;
}
}
return answer;
}
}
'코딩테스트-알고리즘 > 도전' 카테고리의 다른 글
2023.12.31 - 5문제 (0) | 2023.12.31 |
---|---|
2023.12.30 - 10문제 (0) | 2023.12.30 |
2023.12.25 - 6문제 (0) | 2023.12.25 |
2023.12.24 - 4문제 (0) | 2023.12.24 |
2023.12.23 - 9문제 (1) | 2023.12.23 |