본문 바로가기
728x90
반응형

알고리즘/Java6

프로그래머스 코딩테스트 Level 2. 멀리뛰기 with Java 문제https://school.programmers.co.kr/learn/courses/30/lessons/12914 프로그래머스코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요.programmers.co.kr 풀이class Solution { public long solution(int n) { // 피보나치수열 long[] dp = new long[n + 2]; dp[0] = 0; dp[1] = 1; dp[2] = 2; for (int i=3; i https://github.com/yhyuk/.. 2024. 9. 20.
프로그래머스 코딩테스트 Level 2. 구명보트 with Java 문제https://school.programmers.co.kr/learn/courses/30/lessons/42885 프로그래머스코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요.programmers.co.kr 풀이import java.util.*;class Solution { public int solution(int[] people, int limit) { int answer = 0; Arrays.sort(people); int temp = 0; for (int i=people.length-1; i>=temp; i--) { .. 2024. 9. 20.
프로그래머스 코딩테스트 Level 2. 피보나치 수 with Java 문제https://school.programmers.co.kr/learn/courses/30/lessons/12945 프로그래머스코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요.programmers.co.kr 풀이class Solution { public int solution(int n) { int[] answer = new int[n + 1]; answer[0] = 0; answer[1] = 1; for (int i=2; i https://github.com/yhyuk/h-algorithm/tree/master/%ED%94%84%.. 2024. 9. 17.
프로그래머스 코딩테스트 Level 2. 다음 큰 숫자 with Java 문제https://school.programmers.co.kr/learn/courses/30/lessons/12911 프로그래머스코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요.programmers.co.kr 풀이class Solution { public int solution(int n) { int answer = 0; int count = Integer.bitCount(n); while(true) { n++; int nextCount = Integer.bitCount.. 2024. 9. 12.
프로그래머스 코딩테스트 Level 2. 숫자의 표현 with Java 문제https://school.programmers.co.kr/learn/courses/30/lessons/12924 프로그래머스코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요.programmers.co.kr 풀이class Solution { public int solution(int n) { int answer = 0; for (int i=1; i n) break; } } return answer; }}1. 첫번째 for : 자연수 합 sum 초기화2.두번째 for : 1씩 증가하면서 sum .. 2024. 9. 11.
프로그래머스 코딩테스트 Level 2. 이진 변환 반복하기 with Java 문제https://school.programmers.co.kr/learn/courses/30/lessons/70129 프로그래머스코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요.programmers.co.kr 풀이class Solution { public int[] solution(String s) { int[] answer = {0,0}; while(!s.equals("1")) { int temp = s.length(); s = s.replaceAll("0", ""); answ.. 2024. 9. 10.
728x90
반응형