틀렸음.
https://velog.io/write?id=eb16ff25-b3c3-4844-a0d5-768deda2e0ec
class Solution {
public String solution(String number, int k) {
int jIndex = 0;
int tempIndex = 0;
var sb = new StringBuilder();
for(int i=0; i<number.length()-k; i++)
{
int max = 0;
for(int j=jIndex; j<=i+k; j++)
{
int numberPartial = number.charAt(j) - '0';
if(numberPartial > max)
{
max = numberPartial;
tempIndex = j;
}
}
sb.append(max);
jIndex = tempIndex+1;
}
return sb.toString();
}
}
익힐것
1. String에서 .charAt(j) - '0'; => int 추출
2. 두번째 for문 <= 이고
3. jIndex = tempIndex + 1; 이다.