Skip to content

Commit

Permalink
[level 2] Title: 큰 수 만들기, Time: 0.01 ms, Memory: 4.14 MB -BaekjoonHub
Browse files Browse the repository at this point in the history
  • Loading branch information
developeSHG committed Jul 27, 2023
1 parent 15c9126 commit 98370c4
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

### 성능 요약

메모리: 4.02 MB, 시간: 0.01 ms
메모리: 4.14 MB, 시간: 0.01 ms

### 구분

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,11 @@ string solution(string number, int k) {

while (answer.length() != cnt)
{
// end에서 구해야 할 남은 개수만큼 뺀 영역까지 최대 값 도출
auto temp = max_element(number.begin() + start, number.end() - cnt + answer.length() + 1);
answer += *temp;
start = temp - number.begin() + 1;

// start를 새롭게 갱신
answer += *temp, start = temp - number.begin() + 1;
}

return answer;
Expand Down

0 comments on commit 98370c4

Please sign in to comment.