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.
๐ ๋ฌธ์ ๋งํฌ
์คํฐ์
โ๏ธ ์์๋ ์๊ฐ
3์๊ฐ
โจ ์๋ ์ฝ๋
-1์ด๋ฏ๋ก ํฌ๊ธฐ๊ฐ n์ด๊ณ ๊ฐ์ด -1
์ธ ๋ฆฌ์คํธ๋ฅผ ๋ง๋ ๋ค.์ธ๋ฑ์ค 0
์ ์ ์ฅํ๋ค.์คํ์ ์์๊ฐ ๋จ์์์ ๋
๊ทธ๋ฆฌ๊ณ์คํ์ ๋ง์ง๋ง ์ธ๋ฑ์ค์ ํ์ฌ A[i] ์ค A[i]๊ฐ ๋ ํฌ๋ฉด ์ธ๋ฑ์ค๋ ์คํฐ์์ ํด๋น
ํ๋ฏ๋ก, ์คํ์์ ์ ๊ฑฐํ๋ฉด์ NGE๋ฅผ A[i]๋ก ์ค์ ํ๋ค.๐ ์๋กญ๊ฒ ์๊ฒ๋ ๋ด์ฉ
์ฐธ์กฐ
์ธ๋ฑ์ค๋ฅผ ๋ํ๋ฉด์ ์คํฐ์๋ฅผ ๋ง๋๋ฉด ์ธ๋ฑ์ค๋ฅผ ๋ค์ ์ด๊ธฐํํ๋ ๋ฐฉ๋ฒ์ ์๊ฐํ๋๋ฐ, ์ธ๋ฑ์ค ๋ฆฌ์คํธ๋ฅผ ์์ ๋ฐ๋ก ๋ง๋ค์ด์ ์คํฐ์๋ฅผ ๋ง๋๋ฉด ์ธ๋ฑ์ค ๋ฆฌ์คํธ์์ pop์ฐ์ฐ์ผ๋ก ๋บ ์๋ ์์๋ค์...