일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
Tags
- 자바 공부
- 코틀린
- 컴퓨터 네트워크
- react
- 코딩테스트 고득점 Kit 완전탐색
- useState
- useEffect
- JavaScript
- 자바
- react hook
- 백준
- 프로그래머스
- 프로그래머스 완전탐색
- 리액트 훅
- vanillaJS
- design pattern
- 자바스크립트
- 코딩테스트 고득점 Kit
- 프로그래밍 언어론
- 디자인 패턴
- 장고
- Java
- 프로그래머스 자바
- codesandbox
- NextJS
- 데이터모델링과마이닝
- 리액트
- websocket
- React JS
- react firebase
Archives
- Today
- Total
기록하는 개발자
[프로그래머스][코딩테스트 고득점 Kit][java] 큰 수 만들기 본문
728x90
https://school.programmers.co.kr/learn/courses/30/lessons/42883
프로그래머스
코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요.
programmers.co.kr
전체 코드
class Solution {
public String solution(String number, int k) {
StringBuilder sb = new StringBuilder();
int index = 0, now = 0;
for(int i=0; i<number.length()-k; i++){
now = 0;
for(int j=index; j<=i+k; j++){
if(now < number.charAt(j)-'0'){
now = number.charAt(j)-'0';
index = j+1;
}
// System.out.println("now : "+now+" i : "+ i + " j : "+ j+ " index : "+ index);
}
sb.append(now);
// System.out.println("[ sb : "+sb+" ]");
}
return sb.toString();
}
}
testcase의 now, i, j , index, sb 출력 결과
728x90
'Algorithm' 카테고리의 다른 글
[프로그래머스][java] 연속된 부분 수열의 합 (0) | 2023.08.29 |
---|---|
[프로그래머스][코딩테스트 고득점 Kit][java] 구명보트 (0) | 2023.08.22 |
[프로그래머스][코딩테스트 고득점 Kit][java] 순위 (0) | 2023.08.21 |
[프로그래머스][코딩테스트 고득점 Kit][java] 도둑질 (0) | 2023.08.21 |
[프로그래머스][코딩테스트 고득점 Kit][java] 카펫 (0) | 2023.08.21 |