[ํ๋ก๊ทธ๋๋จธ์ค] Swift ์๋ฌผ์ ์ ์ด์ 2020 kakao
๋ฌธ์ : https://programmers.co.kr/learn/courses/30/lessons/60059 ์ฝ๋ฉํ
์คํธ ์ฐ์ต - ์๋ฌผ์ ์ ์ด์ [[0, 0, 0], [1, 0, 0], [0, 1, 1]] [[1, 1, 1], [1, 1, 0], [1, 0, 1]] true programmers.co.kr swift ์ฝ๋ : // // main.swift // SOMA๐ฉ๐ป๐ป // // Created by JoSoJeong on 2022/05/12. // import Foundation func rotation(_ arr: [[Int]]) -> [[Int]] { // ์๊ณ ๋ฐฉํฅ์ผ๋ก 90๋ ํ์ var resultArr = Array(repeating: Array(repeating: 0, count: ar..
2022. 5. 13.
[ํ๋ก๊ทธ๋๋จธ์ค] Swift ํ๊ดด๋์ง ์์ ๊ฑด๋ฌผ ๋์ ํฉ
๋ฌธ์ : https://programmers.co.kr/learn/courses/30/lessons/92344 ์ฝ๋ฉํ
์คํธ ์ฐ์ต - ํ๊ดด๋์ง ์์ ๊ฑด๋ฌผ [[5,5,5,5,5],[5,5,5,5,5],[5,5,5,5,5],[5,5,5,5,5]] [[1,0,0,3,4,4],[1,2,0,2,3,2],[2,1,0,3,1,2],[1,0,1,3,3,1]] 10 [[1,2,3],[4,5,6],[7,8,9]] [[1,1,1,2,2,4],[1,0,0,1,1,2],[2,2,0,2,0,100]] 6 programmers.co.kr ์ฐธ๊ณ : https://tech.kakao.com/2022/01/14/2022-kakao-recruitment-round-1/#%EB%AC%B8%EC%A0%9C-6-%ED%8C%8C%EA%B4%B4%..
2022. 5. 2.
[ํ๋ก๊ทธ๋๋จธ์ค] Swift 2022 kakao ์ฃผ์ฐจ ์๊ธ ๊ณ์ฐ
๋ฌธ์ : https://programmers.co.kr/learn/courses/30/lessons/92341 ์ฝ๋ฉํ
์คํธ ์ฐ์ต - ์ฃผ์ฐจ ์๊ธ ๊ณ์ฐ [180, 5000, 10, 600] ["05:34 5961 IN", "06:00 0000 IN", "06:34 0000 OUT", "07:59 5961 OUT", "07:59 0148 IN", "18:59 0000 IN", "19:09 0148 OUT", "22:59 5961 IN", "23:00 5961 OUT"] [14600, 34400, 5000] programmers.co.kr ๋ถ์ : string ํ์ฑ์ ์ด์ฉํ ๊ตฌํ ๋ฌธ์ ์๋ค. C++์์๋ ์๊ฐ์ ๊ตฌํ๋๋ฐ * 60์ ํ๋ ๋ฑ ๋๊ฒ ๋ณต์กํ๋๋ฐ swift๋ DateFormatter()๊ฐ ์๋ค ํํ ๊ทธ๋์..
2022. 4. 19.
[ํ๋ก๊ทธ๋๋จธ์ค] Swift ํํ 2019 ์นด์นด์ค implementation
๋ฌธ์ : https://programmers.co.kr/learn/courses/30/lessons/64065?language=swift ์ฝ๋ฉํ
์คํธ ์ฐ์ต - ํํ "{{2},{2,1},{2,1,3},{2,1,3,4}}" [2, 1, 3, 4] "{{1,2,3},{2,1},{1,2,4,3},{2}}" [2, 1, 3, 4] "{{4,2,3},{3},{2,3,4,1},{2,3}}" [3, 2, 4, 1] programmers.co.kr ๋ถ์ : string ๋ฐฐ์ด์ ๋๋ฉฐ "{" ๊ฐ ๋ํ๋ฌ์๋ "}"๊ฐ ๋ํ๋๊ธฐ ์ ๊น์ง ์์๋ฅผ ํ๋์ฉ ๋ด๋๋ค. result array์ ๊ฐ์ด ์์๋๋ง ์์๋ฅผ ๋ด์ ๋ฆฌํดํ๋๋ก ํ๋๋ฐ ์ด ๋ถ๋ถ์์ O(n^2)์ ์ฌ์ฉํด ๋๊ฒ ๋นํจ์จ์ ์ด๋ผ๋ ์๊ฐ์ด ๋ค์๋ค. ๋ค๋ฅธ ์ฌ๋๋ค ํ์ด๋ฅผ ๋ณด๋ comp..
2022. 4. 14.
[ํ๋ก๊ทธ๋๋จธ์ค] Swift 2020 ์นด์นด์ค ์ธํด์ญ ํคํจ๋ ๋๋ฅด๊ธฐ
๋ฌธ์ : https://programmers.co.kr/learn/courses/30/lessons/67256 ์ฝ๋ฉํ
์คํธ ์ฐ์ต - ํคํจ๋ ๋๋ฅด๊ธฐ [1, 3, 4, 5, 8, 2, 1, 4, 5, 9, 5] "right" "LRLLLRLLRRL" [7, 0, 8, 2, 8, 3, 1, 5, 7, 6, 2] "left" "LRLLRRLLLRR" [1, 2, 3, 4, 5, 6, 7, 8, 9, 0] "right" "LLRLLRLLRL" programmers.co.kr ๋์ด๋ level 1 ๋ถ์ : ๊ฐ๋จํ ๊ตฌํ ๋ฌธ์ ์๋ค ! 1, 4, 7๋ฒ์ ์ผ์์ผ๋ก 3, 6, 9๋ฒ์ ์ค๋ฅธ์์ผ๋ก ๋๋ฅด๊ณ 2, 5, 8, 0 ์ซ์๋ ํ์ฌ ์๋ ์ ์์น์์ ๊ฑฐ๋ฆฌ๊ฐ ๊ฐ๊น์ด ์์ด ๋๋ฅด๋ ๊ตฌํ ๋ฌธ์ ์๋ค. ์ซ์๊ฐ ํ๋ผ๋ฆฐ 3๋งํผ ์ฐจ์ด๊ฐ ๋๊ธฐ..
2022. 4. 8.
[ํ๋ก๊ทธ๋๋จธ์ค] ๊ฐ์ฅ ํฐ ์ STL(sort)
๋ฌธ์ : https://programmers.co.kr/learn/courses/30/lessons/42746 ์ฝ๋ฉํ
์คํธ ์ฐ์ต - ๊ฐ์ฅ ํฐ ์ 0 ๋๋ ์์ ์ ์๊ฐ ์ฃผ์ด์ก์ ๋, ์ ์๋ฅผ ์ด์ด ๋ถ์ฌ ๋ง๋ค ์ ์๋ ๊ฐ์ฅ ํฐ ์๋ฅผ ์์๋ด ์ฃผ์ธ์. ์๋ฅผ ๋ค์ด, ์ฃผ์ด์ง ์ ์๊ฐ [6, 10, 2]๋ผ๋ฉด [6102, 6210, 1062, 1026, 2610, 2106]๋ฅผ ๋ง๋ค ์ ์๊ณ , ์ด์ค ๊ฐ์ฅ ํฐ programmers.co.kr ๋ถ์ : ์ฐ์ ๊ฐ์ฅ ์ฒซ๋ฒ์งธ ์๋ฆฌ๊ฐ ํฐ ์์ ๋จผ์ ์ ๋ ฌ ๋์ด์ผ ํ๋ ๊ฒ์ผ๋ก ๋ณด์ธ๋ค ! ํ์ง๋ง ๋ฌธ์ ๋ ์ฒซ๋ฒ์งธ ์๋ฆฌ ์์๊ฐ ๊ฐ์ ์์๋ค์ด๋ค. ์๋ฅผ ๋ค์ด [8, 3, 30, 34, 36] ๊ฐ ์์๋ ๊ธฐ๋ณธ sortํจ์๋ก ์ ๋ ฌํ๋ฉด [8, 36, 32, 30, 3] ์์ผ๋ก ์ ๋ ฌ๋๋ค. ํ์ง๋ง 32303๋ณด..
2022. 3. 25.
[ํ๋ก๊ทธ๋๋จธ์ค] ํํธ์ง 2021 ์นด์นด์ค ์ธํด์ญ STL(set)
๋ฌธ์ : https://programmers.co.kr/learn/courses/30/lessons/81303 ์ฝ๋ฉํ
์คํธ ์ฐ์ต - ํ ํธ์ง 8 2 ["D 2","C","U 3","C","D 4","C","U 2","Z","Z"] "OOOOXOOO" 8 2 ["D 2","C","U 3","C","D 4","C","U 2","Z","Z","U 1","C"] "OOXOXOOO" programmers.co.kr ๋ถ์ : ์ฃผ์ด์ง ํ ์ ๋ณด๋ฅผ ๋ฒกํฐ์ ๋ด์ erase, insert๋ฑ ๊ธฐ๋ณธ STL ๋ฐฉ์์ผ๋ก ์ ๊ทผํ์๋ค. ํ
์คํธ ์ผ์ด์ค๋ ๋ง์์ผ๋ ์ ํ์ฑ ํ
์คํธ, ํจ์จ์ฑ ํ
์คํธ์์ segmentation fault ์๋ฌ๋ฅผ ๋ฐ์๊ณ ๋ฒกํฐ ๊ณต๊ฐ์ ์ง์ฐ๊ณ ๋ค์ ์ฝ์
ํ๋ ๊ณผ์ ์์ ์ธ๋ฑ์ค ๋ฒ์๋ฅผ ๋์ด์๋ ๊ฒ ๊ฐ์ ์ค๋ฅ๋ฅผ ๋ฒํ๊ฑฐ ๊ฐ๋ค. ..
2021. 9. 9.
[ํ๋ก๊ทธ๋๋จธ์ค] ๊ฑฐ๋ฆฌ๋๊ธฐ ํ์ธํ๊ธฐ 2021 ์นด์นด์ค ์ธํด์ญ DFS
๋ฌธ์ : https://programmers.co.kr/learn/courses/30/lessons/81302 ์ฝ๋ฉํ
์คํธ ์ฐ์ต - ๊ฑฐ๋ฆฌ๋๊ธฐ ํ์ธํ๊ธฐ [["POOOP", "OXXOX", "OPXPX", "OOXOX", "POXXP"], ["POOPX", "OXPXP", "PXXXO", "OXXXO", "OOOPP"], ["PXOPX", "OXOXP", "OXPOX", "OXXOP", "PXPOX"], ["OOOXX", "XOOOX", "OOOXX", "OXOOX", "OOOOO"], ["PXPXP", "XPXPX", "PXPXP", "XPXPX", "PXPXP"]] [1, 0, 1, 1, 1] programmers.co.kr ๋ถ์ : ํฌ๊ธฐ๋ 5X5 ๋ฐฐ์ด ์๋ฅผ ๋ค์ด ์
๋ ฅ์ด 2์ฐจ์ ๋ฐฐ์ด๋ก ์ฃผ์ด์ง ๋ P๋ ์ฌ๋..
2021. 9. 5.
[ํ๋ก๊ทธ๋๋จธ์ค] ๊ฒฝ์ฃผ๋ก ๊ฑด์ค 2020 ์นด์นด์ค ์ธํด์ฝ level3
๋ฌธ์ : programmers.co.kr/learn/courses/30/lessons/67259 ์ฝ๋ฉํ
์คํธ ์ฐ์ต - ๊ฒฝ์ฃผ๋ก ๊ฑด์ค [[0,0,0,0,0,0,0,1],[0,0,0,0,0,0,0,0],[0,0,0,0,0,1,0,0],[0,0,0,0,1,0,0,0],[0,0,0,1,0,0,0,1],[0,0,1,0,0,0,1,0],[0,1,0,0,0,1,0,0],[1,0,0,0,0,0,0,0]] 3800 [[0,0,1,0],[0,0,0,0],[0,1,0,1],[1,0,0,0]] 2100 [[0,0,0,0,0,0],[0,1,1,1,1,0],[0,0,1,0,0,0],[1,0,0,1,0,1],[ programmers.co.kr ๋ถ์ : ์ด ๋ฌธ์ ๋ ๋ฐฑ์ค์์ ํ์๋ ๋ด๋ฆฌ๋ง๊ธธ ๋ฌธ์ ์ ๋น์ทํ๊ฒ dp + dfs์ ์กฐํฉ๋ฌธ์ ์๋ค...
2021. 5. 7.