Algorithm/Softeer ๊ฒ€์ƒ‰ ๊ฒฐ๊ณผ

ํ•ด๋‹น ๊ธ€ 11๊ฑด

https://softeer.ai/practice/info.do?idx=1&eid=626&sw_prbl_sbms_sn=178347 Softeer ์—ฐ์Šต๋ฌธ์ œ๋ฅผ ๋‹ด์„ Set์„ ์„ ํƒํ•ด์ฃผ์„ธ์š”. ์ทจ์†Œ ํ™•์ธ softeer.ai 1. ๋ฌธ์ œ N๊ฐœ์˜ ํšŒ์˜์‹ค, M๊ฐœ์˜ ์˜ˆ์•ฝํ˜„ํ™ฉ์ด ์ฃผ์–ด์ง€๊ณ  ํšŒ์˜์‹ค๋งˆ๋‹ค ์˜ˆ์•ฝ์ด ์ฐจ์ง€ ์•Š์€ ์‹œ๊ฐ„๋Œ€์˜ ๊ฐœ์ˆ˜์™€ ์‹œ๊ฐ„๋Œ€๋ฅผ ์ถœ๋ ฅํ•œ๋‹ค. 2. ํ’€์ด TreeMap, StringBuilder, ์ด์ฐจ์›๋ฐฐ์—ด์„ ์‚ฌ์šฉํ•œ ๊ตฌํ˜„ ๋ฌธ์ œ๋‹ค. TreeMap - ์ด์ „์—๋Š” HashMap์„ ์‚ฌ์šฉํ–ˆ๋Š”๋ฐ ๋งค๋ฒˆ pq์—๋„ ๊ฐ™์ด ๋„ฃ์–ด์„œ ์ •๋ ฌํ•œ ํ›„ pollํ•œ ๊ฐ’์„ HashMap์˜ key๋กœ ์‚ฌ์šฉํ•˜๋Š” ๋ฐฉ์‹์œผ๋กœ ์˜ค๋ฆ„์ฐจ์ˆœ์„ ๊ตฌํ˜„ํ–ˆ๋‹ค. ํ•˜์ง€๋งŒ ํ›จ์”ฌ ์œ ์šฉํ•˜๊ฒŒ ์“ฐ์ด๋Š” ์ž๋ฃŒ๊ตฌ์กฐ TreeMap์ด๋ž€๊ฑธ ์•Œ๊ฒŒ๋˜์—ˆ๋‹ค. - TreeMap์€ key๊ฐ’์„ ์ž๋™์œผ๋กœ ์˜ค๋ฆ„์ฐจ์ˆœ ์ •..

Algorithm/Softeer 2023. 4. 25. 07:25