{"id":1299,"date":"2022-10-24T15:15:13","date_gmt":"2022-10-24T06:15:13","guid":{"rendered":"https:\/\/blog.dozzing.kr\/?p=1299"},"modified":"2026-03-17T15:10:41","modified_gmt":"2026-03-17T06:10:41","slug":"%ec%bd%94%eb%94%a9%ed%85%8c%ec%8a%a4%ed%8a%b8-%ed%81%ac%eb%a0%88%ec%9d%b8-%ec%9d%b8%ed%98%95%eb%bd%91%ea%b8%b0-%ea%b2%8c%ec%9e%84-%e2%ad%90","status":"publish","type":"post","link":"https:\/\/blog.dozzing.kr\/?p=1299","title":{"rendered":"[Coding Test] \ud06c\ub808\uc778 \uc778\ud615\ubf51\uae30 \uac8c\uc784 \u2b50"},"content":{"rendered":"<p><dodo>\ud83d\udc33<strong><yy><a class=\"wp-editor-md-post-content-link\" href=\"https:\/\/school.programmers.co.kr\/learn\/courses\/30\/lessons\/64061\">2019 \uce74\uce74\uc624 \uac1c\ubc1c\uc790 \uaca8\uc6b8 \uc778\ud134\uc2ed \ud06c\ub808\uc778 \uc778\ud615\ubf51\uae30 \uac8c\uc784 \u2b50<\/a><\/yy><\/strong> \ucf54\ub529 \ud14c\uc2a4\ud2b8 \ubb38\uc81c\ub97c \ud480\uace0 \uc815\ub9ac\ud55c \uae00\uc785\ub2c8\ub2e4 \ud83d\udc33<\/dodo><\/p>\n<h2>\ud83d\udcab \ubb38\uc81c \uc124\uba85<\/h2>\n<h3>\ub9e4\uac1c\ubcc0\uc218<\/h3>\n<ul>\n<li><code>board<\/code> : \uac8c\uc784 \ud654\uba74\uc758 \uaca9\uc790\uc758 \uc0c1\ud0dc\uac00 \ub2f4\uae34 2\ucc28\uc6d0 \ubc30\uc5f4\n<ul>\n<li>2\ucc28\uc6d0 \ubc30\uc5f4<\/li>\n<li>\ud06c\uae30\ub294 <code>5 x 5<\/code> \uc774\uc0c1 <code>30 x 30<\/code> \uc774\ud558<\/li>\n<li>\uac01 \uce78\uc5d0\ub294 <code>0 \uc774\uc0c1 100 \uc774\ud558\uc778 \uc815\uc218<\/code>\uac00 \ub2f4\uaca8\uc788\uc2b5\ub2c8\ub2e4.\n<ul>\n<li>0\uc740 \ube48 \uce78\uc744 \ub098\ud0c0\ub0c5\ub2c8\ub2e4.<\/li>\n<li>1 ~ 100\uc758 \uac01 \uc22b\uc790\ub294 \uac01\uae30 \ub2e4\ub978 \uc778\ud615\uc758 \ubaa8\uc591\uc744 \uc758\ubbf8\ud558\uba70 \uac19\uc740 \uc22b\uc790\ub294 \uac19\uc740 \ubaa8\uc591\uc758 \uc778\ud615\uc744 \ub098\ud0c0\ub0c5\ub2c8\ub2e4.<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<\/li>\n<li><code>moves<\/code> : \uc778\ud615\uc744 \uc9d1\uae30 \uc704\ud574 \ud06c\ub808\uc778\uc744 \uc791\ub3d9\uc2dc\ud0a8 \uc704\uce58\uac00 \ub2f4\uae34 \ubc30\uc5f4\n<ul>\n<li>\ud06c\uae30\ub294 <code>1<\/code> \uc774\uc0c1 <code>1,000<\/code> \uc774\ud558<\/li>\n<li>\uac01 \uc6d0\uc18c\ub4e4\uc758 \uac12\uc740 <code>1<\/code> \uc774\uc0c1 <code>board \ubc30\uc5f4\uc758 \uac00\ub85c \ud06c\uae30<\/code> \uc774\ud558\uc778 \uc790\uc5f0\uc218<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<p>\u2192 \ud06c\ub808\uc778\uc744 \ubaa8\ub450 \uc791\ub3d9\uc2dc\ud0a8 \ud6c4 <strong>\ud130\ud2b8\ub824\uc838 \uc0ac\ub77c\uc9c4 \uc778\ud615\uc758 \uac1c\uc218<\/strong>\ub97c return \ud558\ub3c4\ub85d solution \ud568\uc218\ub97c \uc644\uc131<\/p>\n<hr \/>\n<table>\n<thead>\n<tr>\n<th>board<\/th>\n<th>moves<\/th>\n<th>result<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td>[[0,0,0,0,0],[0,0,1,0,3],[0,2,5,0,1],[4,2,4,4,2],[3,5,1,3,1]]<\/td>\n<td>[1,5,3,5,1,2,1,4]<\/td>\n<td>4<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<ul>\n<li><strong>\"N x N\"<\/strong>\u00a0\ud06c\uae30\uc758 \uc815\uc0ac\uac01 \uaca9\uc790<\/li>\n<li><code>board<\/code> \uc758 \uc22b\uc790 = \uc778\ud615(\uac19\uc740 \uc22b\uc790 = \uac19\uc740 \uc778\ud615), 0 = \ube48\uce78<\/li>\n<li>\uaca9\uc790\uc758 \uac00\uc7a5 \uc544\ub798 \uce78\ubd80\ud130 \uc313\uc5ec \uc788\uc74c<\/li>\n<li><code>moves<\/code> \uc5d0 \ud574\ub2f9\ud558\ub294 \uac00\uc7a5 \uc704\uc5d0 \uc788\ub294 \uc778\ud615\uc744 \uc9d1\uc5b4 \uc62c\ub9b4 \uc218 \uc788\uc74c<\/li>\n<li>\uc9d1\uc5b4 \uc62c\ub9b0 \uc778\ud615\uc740 \ubc14\uad6c\ub2c8\uc758 \uac00\uc7a5 \uc544\ub798 \uce78\ubd80\ud130 \uc778\ud615\uc774 \uc21c\uc11c\ub300\ub85c \uc313\uc784<\/li>\n<li>\uac19\uc740 \uc778\ud615(\uac19\uc740 \uc22b\uc790) \ub450 \uac1c\uac00 \ubc14\uad6c\ub2c8\uc5d0 \uc5f0\uc18d\ud574\uc11c \uc313\uc774\uac8c \ub418\uba74 \ub450 \uc778\ud615\uc740 \ubc14\uad6c\ub2c8\uc5d0\uc11c \uc0ac\ub77c\uc9d0<\/li>\n<li>\uc778\ud615\uc774 \uc5c6\ub294 \uacf3\uc5d0\uc11c \ud06c\ub808\uc778\uc744 \uc791\ub3d9 \uc2dc\ud0a4\ub294 \uacbd\uc6b0, \uc544\ubb34 \uc77c\ub3c4 \uc5c6\uc74c<\/li>\n<li>\ubc14\uad6c\ub2c8\ub294 \ubaa8\ub4e0 \uc778\ud615\uc774 \ub4e4\uc5b4\uac08 \uc218 \uc788\uc744 \ub9cc\ud07c \ucda9\ubd84\ud788 \ud06c\ub2e4\uace0 \uac00\uc815<\/li>\n<\/ul>\n<h2>\ud83d\udcab \ucf54\ub4dc<\/h2>\n<pre><code class=\"language-python line-numbers\">def solution(board, moves):\n    y = [None for i in range(len(board[0]))]\n    cnt = 0\n    arr = []\n\n    for i in range(len(board)):\n        for j in range(len(board[i])):\n            if board[i][j] != 0:\n                if y[j] is None:\n                    y[j] = i\n\n    for move in moves:\n        move -= 1\n        if board[y[move]][move] != 0:\n            if len(arr) &gt; 0 and (arr[-1] == board[y[move]][move]):\n                cnt += 2\n                arr.pop()\n            else:\n                arr.append(board[y[move]][move])\n            board[y[move]][move] = 0\n            if y[move] + 1 &lt; len(board):\n                y[move] += 1\n    return cnt\n<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>\ud83d\udc332019 \uce74\uce74\uc624 \uac1c\ubc1c\uc790 \uaca8\uc6b8 \uc778\ud134\uc2ed \ud06c\ub808\uc778 \uc778\ud615\ubf51\uae30 \uac8c\uc784 \u2b50 \ucf54\ub529 \ud14c\uc2a4\ud2b8 \ubb38\uc81c\ub97c \ud480\uace0 \uc815\ub9ac\ud55c \uae00\uc785\ub2c8\ub2e4 \ud83d\udc33 \ud83d\udcab \ubb38\uc81c \uc124\uba85 \ub9e4\uac1c\ubcc0\uc218 board : \uac8c\uc784 \ud654\uba74\uc758 \uaca9\uc790\uc758 \uc0c1\ud0dc\uac00 \ub2f4\uae34 2\ucc28\uc6d0 \ubc30\uc5f4 2\ucc28\uc6d0 \ubc30\uc5f4 \ud06c\uae30\ub294 5 x 5 \uc774\uc0c1 30 x 30 \uc774\ud558 \uac01 \uce78\uc5d0\ub294 0 \uc774\uc0c1 100 \uc774\ud558\uc778 \uc815\uc218\uac00 \ub2f4\uaca8\uc788\uc2b5\ub2c8\ub2e4. 0\uc740 \ube48 \uce78\uc744 \ub098\ud0c0\ub0c5\ub2c8\ub2e4. 1 ~ 100\uc758 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[59,60],"tags":[26,69,11,42,10],"class_list":["post-1299","post","type-post","status-publish","format-standard","hentry","category-coding-test","category-programmers","tag-26","tag-coding-test","tag-programmers","tag-python","tag-10"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v25.6 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>[Coding Test] \ud06c\ub808\uc778 \uc778\ud615\ubf51\uae30 \uac8c\uc784 \u2b50 - Dozzing World<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/blog.dozzing.kr\/?p=1299\" \/>\n<meta property=\"og:locale\" content=\"ko_KR\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"[Coding Test] \ud06c\ub808\uc778 \uc778\ud615\ubf51\uae30 \uac8c\uc784 \u2b50 - Dozzing World\" \/>\n<meta property=\"og:description\" content=\"\ud83d\udc332019 \uce74\uce74\uc624 \uac1c\ubc1c\uc790 \uaca8\uc6b8 \uc778\ud134\uc2ed \ud06c\ub808\uc778 \uc778\ud615\ubf51\uae30 \uac8c\uc784 \u2b50 \ucf54\ub529 \ud14c\uc2a4\ud2b8 \ubb38\uc81c\ub97c \ud480\uace0 \uc815\ub9ac\ud55c \uae00\uc785\ub2c8\ub2e4 \ud83d\udc33 \ud83d\udcab \ubb38\uc81c \uc124\uba85 \ub9e4\uac1c\ubcc0\uc218 board : \uac8c\uc784 \ud654\uba74\uc758 \uaca9\uc790\uc758 \uc0c1\ud0dc\uac00 \ub2f4\uae34 2\ucc28\uc6d0 \ubc30\uc5f4 2\ucc28\uc6d0 \ubc30\uc5f4 \ud06c\uae30\ub294 5 x 5 \uc774\uc0c1 30 x 30 \uc774\ud558 \uac01 \uce78\uc5d0\ub294 0 \uc774\uc0c1 100 \uc774\ud558\uc778 \uc815\uc218\uac00 \ub2f4\uaca8\uc788\uc2b5\ub2c8\ub2e4. 0\uc740 \ube48 \uce78\uc744 \ub098\ud0c0\ub0c5\ub2c8\ub2e4. 1 ~ 100\uc758 [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/blog.dozzing.kr\/?p=1299\" \/>\n<meta property=\"og:site_name\" content=\"Dozzing World\" \/>\n<meta property=\"article:published_time\" content=\"2022-10-24T06:15:13+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2026-03-17T06:10:41+00:00\" \/>\n<meta name=\"author\" content=\"Dozzing\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"\uae00\uc4f4\uc774\" \/>\n\t<meta name=\"twitter:data1\" content=\"Dozzing\" \/>\n\t<meta name=\"twitter:label2\" content=\"\uc608\uc0c1 \ub418\ub294 \ud310\ub3c5 \uc2dc\uac04\" \/>\n\t<meta name=\"twitter:data2\" content=\"2\ubd84\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/blog.dozzing.kr\/?p=1299\",\"url\":\"https:\/\/blog.dozzing.kr\/?p=1299\",\"name\":\"[Coding Test] \ud06c\ub808\uc778 \uc778\ud615\ubf51\uae30 \uac8c\uc784 \u2b50 - Dozzing World\",\"isPartOf\":{\"@id\":\"https:\/\/blog.dozzing.kr\/#website\"},\"datePublished\":\"2022-10-24T06:15:13+00:00\",\"dateModified\":\"2026-03-17T06:10:41+00:00\",\"author\":{\"@id\":\"https:\/\/blog.dozzing.kr\/#\/schema\/person\/52258baef65b530d3e867e4c1f79c36f\"},\"breadcrumb\":{\"@id\":\"https:\/\/blog.dozzing.kr\/?p=1299#breadcrumb\"},\"inLanguage\":\"ko-KR\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/blog.dozzing.kr\/?p=1299\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/blog.dozzing.kr\/?p=1299#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/blog.dozzing.kr\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"[Coding Test] \ud06c\ub808\uc778 \uc778\ud615\ubf51\uae30 \uac8c\uc784 \u2b50\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/blog.dozzing.kr\/#website\",\"url\":\"https:\/\/blog.dozzing.kr\/\",\"name\":\"Dozzing World\",\"description\":\"\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/blog.dozzing.kr\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"ko-KR\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/blog.dozzing.kr\/#\/schema\/person\/52258baef65b530d3e867e4c1f79c36f\",\"name\":\"Dozzing\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"ko-KR\",\"@id\":\"https:\/\/blog.dozzing.kr\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/0bbe3fe675c3641965411ffb61a1368b3bf05e794deaa3c7bd0ef7b4690a614a?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/0bbe3fe675c3641965411ffb61a1368b3bf05e794deaa3c7bd0ef7b4690a614a?s=96&d=mm&r=g\",\"caption\":\"Dozzing\"},\"sameAs\":[\"https:\/\/blog.dozzing.kr\/\"],\"url\":\"https:\/\/blog.dozzing.kr\/?author=1\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"[Coding Test] \ud06c\ub808\uc778 \uc778\ud615\ubf51\uae30 \uac8c\uc784 \u2b50 - Dozzing World","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/blog.dozzing.kr\/?p=1299","og_locale":"ko_KR","og_type":"article","og_title":"[Coding Test] \ud06c\ub808\uc778 \uc778\ud615\ubf51\uae30 \uac8c\uc784 \u2b50 - Dozzing World","og_description":"\ud83d\udc332019 \uce74\uce74\uc624 \uac1c\ubc1c\uc790 \uaca8\uc6b8 \uc778\ud134\uc2ed \ud06c\ub808\uc778 \uc778\ud615\ubf51\uae30 \uac8c\uc784 \u2b50 \ucf54\ub529 \ud14c\uc2a4\ud2b8 \ubb38\uc81c\ub97c \ud480\uace0 \uc815\ub9ac\ud55c \uae00\uc785\ub2c8\ub2e4 \ud83d\udc33 \ud83d\udcab \ubb38\uc81c \uc124\uba85 \ub9e4\uac1c\ubcc0\uc218 board : \uac8c\uc784 \ud654\uba74\uc758 \uaca9\uc790\uc758 \uc0c1\ud0dc\uac00 \ub2f4\uae34 2\ucc28\uc6d0 \ubc30\uc5f4 2\ucc28\uc6d0 \ubc30\uc5f4 \ud06c\uae30\ub294 5 x 5 \uc774\uc0c1 30 x 30 \uc774\ud558 \uac01 \uce78\uc5d0\ub294 0 \uc774\uc0c1 100 \uc774\ud558\uc778 \uc815\uc218\uac00 \ub2f4\uaca8\uc788\uc2b5\ub2c8\ub2e4. 0\uc740 \ube48 \uce78\uc744 \ub098\ud0c0\ub0c5\ub2c8\ub2e4. 1 ~ 100\uc758 [&hellip;]","og_url":"https:\/\/blog.dozzing.kr\/?p=1299","og_site_name":"Dozzing World","article_published_time":"2022-10-24T06:15:13+00:00","article_modified_time":"2026-03-17T06:10:41+00:00","author":"Dozzing","twitter_card":"summary_large_image","twitter_misc":{"\uae00\uc4f4\uc774":"Dozzing","\uc608\uc0c1 \ub418\ub294 \ud310\ub3c5 \uc2dc\uac04":"2\ubd84"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/blog.dozzing.kr\/?p=1299","url":"https:\/\/blog.dozzing.kr\/?p=1299","name":"[Coding Test] \ud06c\ub808\uc778 \uc778\ud615\ubf51\uae30 \uac8c\uc784 \u2b50 - Dozzing World","isPartOf":{"@id":"https:\/\/blog.dozzing.kr\/#website"},"datePublished":"2022-10-24T06:15:13+00:00","dateModified":"2026-03-17T06:10:41+00:00","author":{"@id":"https:\/\/blog.dozzing.kr\/#\/schema\/person\/52258baef65b530d3e867e4c1f79c36f"},"breadcrumb":{"@id":"https:\/\/blog.dozzing.kr\/?p=1299#breadcrumb"},"inLanguage":"ko-KR","potentialAction":[{"@type":"ReadAction","target":["https:\/\/blog.dozzing.kr\/?p=1299"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/blog.dozzing.kr\/?p=1299#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/blog.dozzing.kr\/"},{"@type":"ListItem","position":2,"name":"[Coding Test] \ud06c\ub808\uc778 \uc778\ud615\ubf51\uae30 \uac8c\uc784 \u2b50"}]},{"@type":"WebSite","@id":"https:\/\/blog.dozzing.kr\/#website","url":"https:\/\/blog.dozzing.kr\/","name":"Dozzing World","description":"","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/blog.dozzing.kr\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"ko-KR"},{"@type":"Person","@id":"https:\/\/blog.dozzing.kr\/#\/schema\/person\/52258baef65b530d3e867e4c1f79c36f","name":"Dozzing","image":{"@type":"ImageObject","inLanguage":"ko-KR","@id":"https:\/\/blog.dozzing.kr\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/0bbe3fe675c3641965411ffb61a1368b3bf05e794deaa3c7bd0ef7b4690a614a?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/0bbe3fe675c3641965411ffb61a1368b3bf05e794deaa3c7bd0ef7b4690a614a?s=96&d=mm&r=g","caption":"Dozzing"},"sameAs":["https:\/\/blog.dozzing.kr\/"],"url":"https:\/\/blog.dozzing.kr\/?author=1"}]}},"_links":{"self":[{"href":"https:\/\/blog.dozzing.kr\/index.php?rest_route=\/wp\/v2\/posts\/1299","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.dozzing.kr\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.dozzing.kr\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.dozzing.kr\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.dozzing.kr\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1299"}],"version-history":[{"count":4,"href":"https:\/\/blog.dozzing.kr\/index.php?rest_route=\/wp\/v2\/posts\/1299\/revisions"}],"predecessor-version":[{"id":1303,"href":"https:\/\/blog.dozzing.kr\/index.php?rest_route=\/wp\/v2\/posts\/1299\/revisions\/1303"}],"wp:attachment":[{"href":"https:\/\/blog.dozzing.kr\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1299"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.dozzing.kr\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1299"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.dozzing.kr\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1299"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}