• [HackerRank] Higher Than 75 Marks

    ๋ฌธ์ œ ์„ค๋ช… Query theย Nameย of any student inย STUDENTS who scored higher thanย ย Marks. Order your output by theย last three charactersย of each name. If two or more students both have names ending in the same last three characters (i.e.: Bobby, Robby, etc.), secondary sort them by ascendingย ID. Input Format Theย STUDENTSย table is described as follows: ย Theย Nameย column only contains upperc..

  • [HackerRank] Basic SELECT

    HackerRank์—์„œ BASIC ๋ฌธ์ œ์— ํ•ด๋‹นํ•˜๋Š” Weather Observation Station์— ํ•ด๋‹นํ•˜๋Š” ๋ฌธ์ œ๋“ค์„ ํ’€์—ˆ์Šต๋‹ˆ๋‹ค. ๋ฌธ์ž์—ด์ด ํฌํ•จ๋˜๋Š” ๊ฒฝ์šฐ, ํฌํ•จ๋˜์ง€ ์•Š๋Š” ๊ฒฝ์šฐ๋ฅผ LOWER, SUBSTR, NOT IN์„ ์‚ฌ์šฉํ•ด์„œ ํ’€์—ˆ์Šต๋‹ˆ๋‹ค. # 8 - ๋‹ค์ค‘ ์กฐ๊ฑด, LIKE ์‚ฌ์šฉ SELECT DISTINCT CITY FROM STATION WHERE (CITY LIKE 'a%' OR CITY LIKE 'e%' OR CITY LIKE 'i%' OR CITY LIKE 'o%' OR CITY LIKE 'u%') AND (CITY LIKE '%a' OR CITY LIKE '%e' OR CITY LIKE '%i'..

  • [Programmers] ๊นŠ์ด/๋„ˆ๋น„์šฐ์„ ํƒ์ƒ‰(DFS/BFS) - ๋‹จ์–ด ๋ณ€ํ™˜

    ํ•ด๋‹น ๊ธ€์€ ํ”„๋กœ๊ทธ๋ž˜๋จธ์Šค ๋ฌธ์ œ๋ฅผ ํ‘ผ ๋‚ด์šฉ์ž…๋‹ˆ๋‹ค. ํ”„๋กœ๊ทธ๋ž˜๋จธ์Šค - ๋‹จ์–ด ๋ณ€ํ™˜: https://programmers.co.kr/learn/courses/30/lessons/43163 ๋ฌธ์ œ ์„ค๋ช… ๋‘ ๊ฐœ์˜ ๋‹จ์–ด begin, target๊ณผ ๋‹จ์–ด์˜ ์ง‘ํ•ฉ words๊ฐ€ ์žˆ์Šต๋‹ˆ๋‹ค. ์•„๋ž˜์™€ ๊ฐ™์€ ๊ทœ์น™์„ ์ด์šฉํ•˜์—ฌ begin์—์„œ target์œผ๋กœ ๋ณ€ํ™˜ํ•˜๋Š” ๊ฐ€์žฅ ์งง์€ ๋ณ€ํ™˜ ๊ณผ์ •์„ ์ฐพ์œผ๋ ค๊ณ  ํ•ฉ๋‹ˆ๋‹ค. 1. ํ•œ ๋ฒˆ์— ํ•œ ๊ฐœ์˜ ์•ŒํŒŒ๋ฒณ๋งŒ ๋ฐ”๊ฟ€ ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. 2. words์— ์žˆ๋Š” ๋‹จ์–ด๋กœ๋งŒ ๋ณ€ํ™˜ํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. ์˜ˆ๋ฅผ ๋“ค์–ด beg..

  • [Programmers] ํž™(heap) - ๋””์Šคํฌ ์ปจํŠธ๋กค๋Ÿฌ

    ํ•ด๋‹น ๊ธ€์€ ํ”„๋กœ๊ทธ๋ž˜๋จธ์Šค์˜ ์ฝ”๋”ฉ ๋ฌธ์ œ๋ฅผ ํ’€๊ณ  ์ž‘์„ฑํ–ˆ์Šต๋‹ˆ๋‹ค. ํ”„๋กœ๊ทธ๋ž˜๋จธ์Šค - ๋””์Šคํฌ ์ปจํŠธ๋กค๋Ÿฌ: ๋ฌธ์ œ ์„ค๋ช… ํ•˜๋“œ๋””์Šคํฌ๋Š” ํ•œ ๋ฒˆ์— ํ•˜๋‚˜์˜ ์ž‘์—…๋งŒ ์ˆ˜ํ–‰ํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. ๋””์Šคํฌ ์ปจํŠธ๋กค๋Ÿฌ๋ฅผ ๊ตฌํ˜„ํ•˜๋Š” ๋ฐฉ๋ฒ•์€ ์—ฌ๋Ÿฌ ๊ฐ€์ง€๊ฐ€ ์žˆ์Šต๋‹ˆ๋‹ค. ๊ฐ€์žฅ ์ผ๋ฐ˜์ ์ธ ๋ฐฉ๋ฒ•์€ ์š”์ฒญ์ด ๋“ค์–ด์˜จ ์ˆœ์„œ๋Œ€๋กœ ์ฒ˜๋ฆฌํ•˜๋Š” ๊ฒƒ์ž…๋‹ˆ๋‹ค. ์˜ˆ๋ฅผ๋“ค์–ด - 0ms ์‹œ์ ์— 3ms๊ฐ€ ์†Œ์š”๋˜๋Š” A์ž‘์—… ์š”์ฒญ - 1ms ์‹œ์ ์— 9ms๊ฐ€ ์†Œ์š”๋˜๋Š” B์ž‘์—… ์š”์ฒญ - 2ms ์‹œ์ ์— 6ms๊ฐ€ ์†Œ์š”๋˜๋Š” C์ž‘์—… ์š”์ฒญ..

  • [Programmers] ํƒ์š•๋ฒ•(Greedy) - ํฐ ์ˆ˜ ๋งŒ๋“ค๊ธฐ

    ๋ฌธ์ œ ์„ค๋ช… ์–ด๋–ค ์ˆซ์ž์—์„œ k๊ฐœ์˜ ์ˆ˜๋ฅผ ์ œ๊ฑฐํ–ˆ์„ ๋•Œ ์–ป์„ ์ˆ˜ ์žˆ๋Š” ๊ฐ€์žฅ ํฐ ์ˆซ์ž๋ฅผ ๊ตฌํ•˜๋ ค ํ•ฉ๋‹ˆ๋‹ค. ์˜ˆ๋ฅผ ๋“ค์–ด, ์ˆซ์ž 1924์—์„œ ์ˆ˜ ๋‘ ๊ฐœ๋ฅผ ์ œ๊ฑฐํ•˜๋ฉด [19, 12, 14, 92, 94, 24] ๋ฅผ ๋งŒ๋“ค ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. ์ด ์ค‘ ๊ฐ€์žฅ ํฐ ์ˆซ์ž๋Š” 94 ์ž…๋‹ˆ๋‹ค. ๋ฌธ์ž์—ด ํ˜•์‹์œผ๋กœ ์ˆซ์ž number์™€ ์ œ๊ฑฐํ•  ์ˆ˜์˜ ๊ฐœ์ˆ˜ k๊ฐ€ solution ํ•จ์ˆ˜์˜ ๋งค๊ฐœ๋ณ€์ˆ˜๋กœ ์ฃผ์–ด์ง‘๋‹ˆ๋‹ค. number์—์„œ k ๊ฐœ์˜ ์ˆ˜๋ฅผ ์ œ๊ฑฐํ–ˆ์„ ๋•Œ ๋งŒ๋“ค ์ˆ˜ ์žˆ๋Š” ์ˆ˜ ์ค‘ ๊ฐ€์žฅ ํฐ ์ˆซ์ž๋ฅผ ๋ฌธ์ž์—ด ํ˜•ํƒœ๋กœ return ํ•˜๋„..

  • [Programmers] ํƒ์š•๋ฒ•(Greedy) - ๊ตฌ๋ช…๋ณดํŠธ

    ํ•ด๋‹น ๋ฌธ์ œ๋Š” ํ”„๋กœ๊ทธ๋ž˜๋จธ์Šค์˜ ํƒ์š•๋ฒ•์— ํ•ด๋‹นํ•˜๋Š” ๋ฌธ์ œ๋ฅผ ํ’€๊ณ  ์ž‘์„ฑํ•œ ๊ฒƒ์ž„์„ ๋ฐํž™๋‹ˆ๋‹ค. ํ”„๋กœ๊ทธ๋ž˜๋จธ์Šค - ๊ตฌ๋ช…๋ณดํŠธ: https://programmers.co.kr/learn/courses/30/lessons/42885 ๋ฌธ์ œ ์„ค๋ช… ๋ฌด์ธ๋„์— ๊ฐ‡ํžŒ ์‚ฌ๋žŒ๋“ค์„ ๊ตฌ๋ช…๋ณดํŠธ๋ฅผ ์ด์šฉํ•˜์—ฌ ๊ตฌ์ถœํ•˜๋ ค๊ณ  ํ•ฉ๋‹ˆ๋‹ค. ๊ตฌ๋ช…๋ณดํŠธ๋Š” ์ž‘์•„์„œ ํ•œ ๋ฒˆ์— ์ตœ๋Œ€ย 2๋ช…์”ฉ ๋ฐ–์— ํƒˆ ์ˆ˜ ์—†๊ณ , ๋ฌด๊ฒŒ ์ œํ•œ๋„ ์žˆ์Šต๋‹ˆ๋‹ค. ์˜ˆ๋ฅผ ๋“ค์–ด, ์‚ฌ๋žŒ๋“ค์˜ ๋ชธ๋ฌด๊ฒŒ๊ฐ€ [70kg, 50kg, 80kg, 50kg]์ด๊ณ  ๊ตฌ๋ช…๋ณดํŠธ์˜ ๋ฌด๊ฒŒ ์ œํ•œ์ด 100kg..

  • [Programmers] ๊ทธ๋ž˜ํ”„(Graph) - ๊ฐ€์žฅ ๋จผ ๋…ธ๋“œ

    ํ•ด๋‹น ๊ธ€์€ ํ”„๋กœ๊ทธ๋ž˜๋จธ์Šค์˜ ๊ทธ๋ž˜ํ”„ ํƒ์ƒ‰ ๊ธฐ๋ฒ•์— ํ•ด๋‹นํ•˜๋Š” ๋ฌธ์ œ๋ฅผ ํ’€๊ณ  ์ž‘์„ฑํ–ˆ์Œ์„ ๋ฐํž™๋‹ˆ๋‹ค. ํ•ด๋‹น ๋ฌธ์ œ๋ฅผ ํ’€๋ฉด์„œ ์ฐธ๊ณ ํ•œ ๋ธ”๋กœ๊ทธ ์ถœ์ฒ˜๋ฅผ ์•„๋ž˜์— ๋ฐํž™๋‹ˆ๋‹ค. ํ”„๋กœ๊ทธ๋ž˜๋จธ์Šค ๋ฌธ์ œ ๋งํฌ - https://programmers.co.kr/learn/courses/30/lessons/49189 ๋ฌธ์ œ ํ’€์ด ์ฐธ๊ณ  - https://velog.io/@younge/Python-ํ”„๋กœ๊ทธ๋ž˜๋จธ์Šค-๊ฐ€์žฅ-๋จผ-๋…ธ๋“œ-๊ทธ๋ž˜ํ”„ ๋ฌธ์ œ ์„ค๋ช… n๊ฐœ์˜ ๋…ธ๋“œ๊ฐ€ ์žˆ๋Š” ๊ทธ๋ž˜ํ”„๊ฐ€ ์žˆ์Šต๋‹ˆ๋‹ค. ๊ฐ ๋…ธ๋“œ๋Š” 1๋ถ€ํ„ฐ n๊นŒ์ง€ ๋ฒˆํ˜ธ๊ฐ€ ์ ํ˜€์žˆ์Šต๋‹ˆ๋‹ค. 1..

  • [Programmers] ํ•ด์‰ฌ - ๋ฒ ์ŠคํŠธ์•จ๋ฒ”

    ํ•ด๋‹น ๊ธ€์€ ํ”„๋กœ๊ทธ๋ž˜๋จธ์Šค ํ•ด์‰ฌ Level3. ๋ฒ ์ŠคํŠธ ์•จ๋ฒ”์„ ํ’€๊ณ  ์ž‘์„ฑํ•œ ๊ธ€์ž„์„ ๋ฐํž™๋‹ˆ๋‹ค. https://programmers.co.kr/learn/courses/30/lessons/42579 ๋ฒ ์ŠคํŠธ์•จ๋ฒ” ๋ฌธ์ œ ์„ค๋ช… ์ŠคํŠธ๋ฆฌ๋ฐ ์‚ฌ์ดํŠธ์—์„œ ์žฅ๋ฅด ๋ณ„๋กœ ๊ฐ€์žฅ ๋งŽ์ด ์žฌ์ƒ๋œ ๋…ธ๋ž˜๋ฅผ ๋‘ ๊ฐœ์”ฉ ๋ชจ์•„ ๋ฒ ์ŠคํŠธ ์•จ๋ฒ”์„ ์ถœ์‹œํ•˜๋ ค ํ•ฉ๋‹ˆ๋‹ค. ๋…ธ๋ž˜๋Š” ๊ณ ์œ  ๋ฒˆํ˜ธ๋กœ ๊ตฌ๋ถ„ํ•˜๋ฉฐ, ๋…ธ๋ž˜๋ฅผ ์ˆ˜๋กํ•˜๋Š” ๊ธฐ์ค€์€ ๋‹ค์Œ๊ณผ ๊ฐ™์Šต๋‹ˆ๋‹ค. ์†ํ•œ ๋…ธ๋ž˜๊ฐ€ ๋งŽ์ด ์žฌ์ƒ๋œ ์žฅ๋ฅด๋ฅผ ๋จผ์ € ์ˆ˜๋กํ•ฉ๋‹ˆ๋‹ค. ์žฅ๋ฅด ๋‚ด์—์„œ ๋งŽ์ด ์žฌ์ƒ๋œ ๋…ธ..