Merged
Conversation
Moonjonghoo
approved these changes
Jan 14, 2025
| } | ||
|
|
||
| return newArr.sort((a, b) => a - b); // 오름차순 정렬 | ||
| } |
Collaborator
There was a problem hiding this comment.
코드를 보다가 생각이난건데, filter 처리하는 부분과 배열이 비어있는지를 나눠서 만들었는데 리턴할떄 삼항연산자로 표현해도 깔끔할거같아요
return newArr.length ? sort된 결과 : [-1]
| stack[stack.length - 1] *= 2; // 해당 점수 2배 | ||
| stack[stack.length - 2] *= 2; // 바로 전 점수도 2배 | ||
| } | ||
| } |
Collaborator
There was a problem hiding this comment.
영어가싫어요처럼 상태를 객체로 매칭해도 괜찮을거같습니다!
| let result = 0; | ||
| for (let i = 0; i < stack.length; i++) { | ||
| result += stack[i]; // 총 점수 구하기 | ||
| } |
Collaborator
There was a problem hiding this comment.
reduce 를 활용해보는것도 좋을거같습니다
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
[tkddbs587] 25.01.09
[스택]
📌 푼 문제
기초
📝 간단한 풀이 과정
문자열 뒤집기
컨트롤 제트
영어가 싫어요
문자열 계산하기
올바른 괄호
크레인 인형뽑기 게임