<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0">
  <channel>
    <title>거북이개발자</title>
    <link>https://sw-ryu.tistory.com/</link>
    <description>거북이개발자</description>
    <language>ko</language>
    <pubDate>Sun, 14 Jun 2026 17:42:07 +0900</pubDate>
    <generator>TISTORY</generator>
    <ttl>100</ttl>
    <managingEditor>류정식</managingEditor>
    <image>
      <title>거북이개발자</title>
      <url>https://tistory1.daumcdn.net/tistory/4423231/attach/9074acc4f61f43e6a4e1042046c2a65c</url>
      <link>https://sw-ryu.tistory.com</link>
    </image>
    <item>
      <title>[인프런] 학급 회장(해쉬)</title>
      <link>https://sw-ryu.tistory.com/109</link>
      <description>&lt;h2 data-ke-size=&quot;size26&quot;&gt;&lt;span&gt;&lt;b&gt;0. 제목&lt;/b&gt;&lt;/span&gt;&lt;/h2&gt;
&lt;ul style=&quot;list-style-type: disc;&quot; data-ke-list-type=&quot;disc&quot;&gt;
&lt;li&gt;학급&amp;nbsp;회장(해쉬)&lt;/li&gt;
&lt;/ul&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&amp;nbsp;&lt;/p&gt;
&lt;hr contenteditable=&quot;false&quot; data-ke-type=&quot;horizontalRule&quot; data-ke-style=&quot;style7&quot; /&gt;
&lt;h2 data-ke-size=&quot;size26&quot;&gt;&lt;span&gt;&lt;b&gt;1. 문제&lt;/b&gt;&lt;/span&gt;&lt;/h2&gt;
&lt;p&gt;&lt;figure class=&quot;imageblock alignCenter&quot; data-origin-width=&quot;719&quot; data-origin-height=&quot;608&quot; data-filename=&quot;33.PNG&quot; data-ke-mobilestyle=&quot;widthOrigin&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/sQ1GW/btq83jj8A4B/NNZJyYj0PCm3Rp9N0V73aK/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/sQ1GW/btq83jj8A4B/NNZJyYj0PCm3Rp9N0V73aK/img.png&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/sQ1GW/btq83jj8A4B/NNZJyYj0PCm3Rp9N0V73aK/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2FsQ1GW%2Fbtq83jj8A4B%2FNNZJyYj0PCm3Rp9N0V73aK%2Fimg.png&quot; data-origin-width=&quot;719&quot; data-origin-height=&quot;608&quot; data-filename=&quot;33.PNG&quot; data-ke-mobilestyle=&quot;widthOrigin&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot;/&gt;&lt;/span&gt;&lt;/figure&gt;
&lt;/p&gt;
&lt;hr contenteditable=&quot;false&quot; data-ke-type=&quot;horizontalRule&quot; data-ke-style=&quot;style7&quot; /&gt;
&lt;h2 data-ke-size=&quot;size26&quot;&gt;&lt;span&gt;&lt;b&gt;2. 풀이 1차&lt;/b&gt;&lt;/span&gt;&lt;/h2&gt;
&lt;ul style=&quot;list-style-type: disc;&quot; data-ke-list-type=&quot;disc&quot;&gt;
&lt;li&gt;dictinary를 이용하였다&lt;/li&gt;
&lt;li&gt;Map은 ES6문법이다.&lt;/li&gt;
&lt;/ul&gt;
&lt;hr contenteditable=&quot;false&quot; data-ke-type=&quot;horizontalRule&quot; data-ke-style=&quot;style7&quot; /&gt;
&lt;h2 data-ke-size=&quot;size26&quot;&gt;&lt;span&gt;&lt;b&gt;3. 코드 1차&lt;/b&gt;&lt;/span&gt;&lt;/h2&gt;
&lt;pre id=&quot;code_1625647050515&quot; class=&quot;javascript&quot; style=&quot;overflow: auto; margin: 28px auto; padding: 0px; color: #555555; background-color: #f6f7f8; overflow-wrap: break-word; font-family: Menlo, Consolas, Monaco, monospace; font-size: 14px; line-height: 20px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;&quot; data-ke-language=&quot;javascript&quot; data-ke-type=&quot;codeblock&quot;&gt;&lt;code&gt;function solution(s) {
    let answer;
    var dic={'A': 0, 'B': 0, 'C': 0, 'D': 0, 'E': 0}
    
    for(var i in str){
        dic[str[i]]+=1;
    }
  answer=Object.keys(dic).reduce((a, b) =&amp;gt; dic[a] &amp;gt; dic[b] ? a : b)
  
    
    
    return answer;
}

let str = &quot;BACBACCACCBDEDE&quot;;
console.log(solution(str));&lt;/code&gt;&lt;/pre&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&amp;nbsp;&lt;/p&gt;
&lt;h2 data-ke-size=&quot;size26&quot;&gt;&lt;span&gt;&lt;b&gt;2. 풀이 2차&lt;/b&gt;&lt;/span&gt;&lt;/h2&gt;
&lt;ul style=&quot;list-style-type: disc;&quot; data-ke-list-type=&quot;disc&quot;&gt;
&lt;li&gt;Map함수를 이용하였다.&lt;/li&gt;
&lt;li&gt;Map&lt;/li&gt;
&lt;/ul&gt;
&lt;hr contenteditable=&quot;false&quot; data-ke-type=&quot;horizontalRule&quot; data-ke-style=&quot;style7&quot; /&gt;
&lt;h2 data-ke-size=&quot;size26&quot;&gt;&lt;span&gt;&lt;b&gt;3. 코드 2차&lt;/b&gt;&lt;/span&gt;&lt;/h2&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&amp;nbsp;&lt;/p&gt;
&lt;pre id=&quot;code_1625647050516&quot; class=&quot;javascript&quot; style=&quot;overflow: auto; margin: 28px auto; padding: 0px; color: #555555; background-color: #f6f7f8; overflow-wrap: break-word; font-family: Menlo, Consolas, Monaco, monospace; font-size: 14px; line-height: 20px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;&quot; data-ke-language=&quot;javascript&quot; data-ke-type=&quot;codeblock&quot;&gt;&lt;code&gt;function solution(s) {
    let answer;
    let sH=new Map();
    
    for(var i of s){
      if(sH.has(i)) sH.set(i, sH.get(i)+1)
      else sH.set(i, 1)
    }
    sum=0;
    for(let [key, value] of sH){
      if (sum&amp;lt;value){
        sum=value;
        answer=key
      }
    }
    


    
    return answer;
}

let str = &quot;BACBACCACCBDEDE&quot;;
console.log(solution(str));&lt;/code&gt;&lt;/pre&gt;</description>
      <category>Algorithm(JavaScript)</category>
      <author>류정식</author>
      <guid isPermaLink="true">https://sw-ryu.tistory.com/109</guid>
      <comments>https://sw-ryu.tistory.com/109#entry109comment</comments>
      <pubDate>Wed, 7 Jul 2021 17:44:01 +0900</pubDate>
    </item>
    <item>
      <title>[인프런] 연속 부분 수열2</title>
      <link>https://sw-ryu.tistory.com/108</link>
      <description>&lt;h2 data-ke-size=&quot;size26&quot;&gt;&lt;span&gt;&lt;b&gt;0. 제목&lt;/b&gt;&lt;/span&gt;&lt;/h2&gt;
&lt;ul style=&quot;list-style-type: disc;&quot; data-ke-list-type=&quot;disc&quot;&gt;
&lt;li&gt;연속&amp;nbsp;부분&amp;nbsp;수열2&lt;/li&gt;
&lt;/ul&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&amp;nbsp;&lt;/p&gt;
&lt;hr contenteditable=&quot;false&quot; data-ke-type=&quot;horizontalRule&quot; data-ke-style=&quot;style7&quot; /&gt;
&lt;h2 data-ke-size=&quot;size26&quot;&gt;&lt;span&gt;&lt;b&gt;1. 문제&lt;/b&gt;&lt;/span&gt;&lt;/h2&gt;
&lt;p&gt;&lt;figure class=&quot;imageblock alignCenter&quot; data-origin-width=&quot;670&quot; data-origin-height=&quot;599&quot; data-filename=&quot;222.PNG&quot; data-ke-mobilestyle=&quot;widthOrigin&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/bVX2Wv/btq8ZJxjicZ/Sv3Kfotvj1vQkfWsAqn9i1/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/bVX2Wv/btq8ZJxjicZ/Sv3Kfotvj1vQkfWsAqn9i1/img.png&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/bVX2Wv/btq8ZJxjicZ/Sv3Kfotvj1vQkfWsAqn9i1/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2FbVX2Wv%2Fbtq8ZJxjicZ%2FSv3Kfotvj1vQkfWsAqn9i1%2Fimg.png&quot; data-origin-width=&quot;670&quot; data-origin-height=&quot;599&quot; data-filename=&quot;222.PNG&quot; data-ke-mobilestyle=&quot;widthOrigin&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot;/&gt;&lt;/span&gt;&lt;/figure&gt;
&lt;/p&gt;
&lt;hr contenteditable=&quot;false&quot; data-ke-type=&quot;horizontalRule&quot; data-ke-style=&quot;style7&quot; /&gt;
&lt;h2 data-ke-size=&quot;size26&quot;&gt;&lt;span&gt;&lt;b&gt;2. 풀이 1차&lt;/b&gt;&lt;/span&gt;&lt;/h2&gt;
&lt;ul style=&quot;list-style-type: disc;&quot; data-ke-list-type=&quot;disc&quot;&gt;
&lt;li&gt;더블포인터 원리 이용해서&lt;/li&gt;
&lt;li&gt;합이 5이하인수는 그 p1, p2사이의 부분수열 갯수를 더한다.&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&lt;/li&gt;
&lt;/ul&gt;
&lt;hr contenteditable=&quot;false&quot; data-ke-type=&quot;horizontalRule&quot; data-ke-style=&quot;style7&quot; /&gt;
&lt;h2 data-ke-size=&quot;size26&quot;&gt;&lt;span&gt;&lt;b&gt;3. 코드&lt;/b&gt;&lt;/span&gt;&lt;/h2&gt;
&lt;pre id=&quot;code_1625641691530&quot; class=&quot;javascript&quot; style=&quot;overflow: auto; margin: 28px auto; padding: 0px; color: #555555; background-color: #f6f7f8; overflow-wrap: break-word; font-family: Menlo, Consolas, Monaco, monospace; font-size: 14px; line-height: 20px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;&quot; data-ke-language=&quot;javascript&quot; data-ke-type=&quot;codeblock&quot;&gt;&lt;code&gt;
function solution(m, arr) {
    let answer = 0
    var n = arr.length
    var p1 = 0;
    var p2 = 0;
    var sum = 0;

    for(p1=0; p1&amp;lt;n; p1++) {
        sum += arr[p1]
        while (sum &amp;gt;m) {
            sum -= arr[p2]
            p2++;
        }
        answer += p1 - p2 + 1;

    }



    return answer;
}

let a = [1, 3, 1, 2, 3];
console.log(solution(5, a));&lt;/code&gt;&lt;/pre&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&amp;nbsp;&lt;/p&gt;
&lt;h2 data-ke-size=&quot;size26&quot;&gt;&amp;nbsp;&lt;/h2&gt;</description>
      <category>Algorithm(JavaScript)</category>
      <author>류정식</author>
      <guid isPermaLink="true">https://sw-ryu.tistory.com/108</guid>
      <comments>https://sw-ryu.tistory.com/108#entry108comment</comments>
      <pubDate>Wed, 7 Jul 2021 16:10:04 +0900</pubDate>
    </item>
    <item>
      <title>[인프런] 연속 부분수열1</title>
      <link>https://sw-ryu.tistory.com/107</link>
      <description>&lt;h2 data-ke-size=&quot;size26&quot;&gt;&lt;span&gt;&lt;b&gt;0. 제목&lt;/b&gt;&lt;/span&gt;&lt;/h2&gt;
&lt;ul style=&quot;list-style-type: disc;&quot; data-ke-list-type=&quot;disc&quot;&gt;
&lt;li&gt;&lt;span&gt;연속 부분수열1&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;hr contenteditable=&quot;false&quot; data-ke-type=&quot;horizontalRule&quot; data-ke-style=&quot;style7&quot; /&gt;
&lt;h2 data-ke-size=&quot;size26&quot;&gt;&lt;span&gt;&lt;b&gt;1. 문제&lt;/b&gt;&lt;/span&gt;&lt;/h2&gt;
&lt;p&gt;&lt;figure class=&quot;imageblock alignCenter&quot; data-origin-width=&quot;662&quot; data-origin-height=&quot;602&quot; data-filename=&quot;aaa1.PNG&quot; data-ke-mobilestyle=&quot;widthOrigin&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/bfRCe7/btq810R9pCN/Bxra7p1mrjkNXZca0iMlpk/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/bfRCe7/btq810R9pCN/Bxra7p1mrjkNXZca0iMlpk/img.png&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/bfRCe7/btq810R9pCN/Bxra7p1mrjkNXZca0iMlpk/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2FbfRCe7%2Fbtq810R9pCN%2FBxra7p1mrjkNXZca0iMlpk%2Fimg.png&quot; data-origin-width=&quot;662&quot; data-origin-height=&quot;602&quot; data-filename=&quot;aaa1.PNG&quot; data-ke-mobilestyle=&quot;widthOrigin&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot;/&gt;&lt;/span&gt;&lt;/figure&gt;
&lt;/p&gt;
&lt;hr contenteditable=&quot;false&quot; data-ke-type=&quot;horizontalRule&quot; data-ke-style=&quot;style7&quot; /&gt;
&lt;h2 data-ke-size=&quot;size26&quot;&gt;&lt;span&gt;&lt;b&gt;2. 풀이&lt;/b&gt;&lt;/span&gt;&lt;span&gt;&lt;b&gt;&lt;/b&gt;&lt;/span&gt;&lt;/h2&gt;
&lt;ul style=&quot;list-style-type: disc;&quot; data-ke-list-type=&quot;disc&quot;&gt;
&lt;li&gt;투포인터 알고리즘을 이용한다.&lt;/li&gt;
&lt;li&gt;p1은 오른쪽으로 더해나가고, p2는 합이 m보다 크거나 같을때 빼진다.&lt;/li&gt;
&lt;/ul&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&amp;nbsp;&lt;/p&gt;
&lt;hr contenteditable=&quot;false&quot; data-ke-type=&quot;horizontalRule&quot; data-ke-style=&quot;style7&quot; /&gt;
&lt;h2 data-ke-size=&quot;size26&quot;&gt;&lt;span&gt;&lt;b&gt;3. 코드&lt;/b&gt;&lt;/span&gt;&lt;/h2&gt;
&lt;pre id=&quot;code_1625635874214&quot; class=&quot;javascript&quot; style=&quot;overflow: auto; margin: 28px auto; padding: 0px; color: #555555; background-color: #f6f7f8; overflow-wrap: break-word; font-family: Menlo, Consolas, Monaco, monospace; font-size: 14px; line-height: 20px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;&quot; data-ke-language=&quot;javascript&quot; data-ke-type=&quot;codeblock&quot;&gt;&lt;code&gt;
function solution(m, arr) {
    let answer = 0
    var p1=0;
    var p2=0;
    var n=arr.length;
    var sum=0;
    while(p1&amp;lt;n){
        
        if(sum===m){
            answer=answer+1;
            sum-=arr[p2];
            p2++;
            continue;
        }
        if(sum&amp;gt;m){
            sum-=arr[p2];
            p2++;
            continue;
        }

        sum+=arr[p1]
        p1++
        console.log(sum)

    }


    return answer;
}

let a = [1, 2, 1, 3, 1, 1, 1, 2];
console.log(solution(6, a));&lt;/code&gt;&lt;/pre&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&amp;nbsp;&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&amp;nbsp;&lt;/p&gt;</description>
      <category>Algorithm(JavaScript)</category>
      <author>류정식</author>
      <guid isPermaLink="true">https://sw-ryu.tistory.com/107</guid>
      <comments>https://sw-ryu.tistory.com/107#entry107comment</comments>
      <pubDate>Wed, 7 Jul 2021 14:33:49 +0900</pubDate>
    </item>
    <item>
      <title>[인프런] 공통원소 구하기</title>
      <link>https://sw-ryu.tistory.com/106</link>
      <description>&lt;h2 data-ke-size=&quot;size26&quot;&gt;&lt;span&gt;&lt;b&gt;0. 제목&lt;/b&gt;&lt;/span&gt;&lt;/h2&gt;
&lt;ul style=&quot;list-style-type: disc;&quot; data-ke-list-type=&quot;disc&quot;&gt;
&lt;li&gt;&lt;span&gt;공통원소 구하기&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;hr contenteditable=&quot;false&quot; data-ke-type=&quot;horizontalRule&quot; data-ke-style=&quot;style7&quot; /&gt;
&lt;h2 data-ke-size=&quot;size26&quot;&gt;&lt;span&gt;&lt;b&gt;1. 문제&lt;/b&gt;&lt;/span&gt;&lt;/h2&gt;
&lt;p&gt;&lt;figure class=&quot;imageblock alignCenter&quot; data-origin-width=&quot;687&quot; data-origin-height=&quot;607&quot; data-filename=&quot;mun2.PNG&quot; data-ke-mobilestyle=&quot;widthOrigin&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/byKCgR/btq8YVX48z1/vE0iiiohGwXxwtFOJ2yZm0/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/byKCgR/btq8YVX48z1/vE0iiiohGwXxwtFOJ2yZm0/img.png&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/byKCgR/btq8YVX48z1/vE0iiiohGwXxwtFOJ2yZm0/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2FbyKCgR%2Fbtq8YVX48z1%2FvE0iiiohGwXxwtFOJ2yZm0%2Fimg.png&quot; data-origin-width=&quot;687&quot; data-origin-height=&quot;607&quot; data-filename=&quot;mun2.PNG&quot; data-ke-mobilestyle=&quot;widthOrigin&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot;/&gt;&lt;/span&gt;&lt;/figure&gt;
&lt;/p&gt;
&lt;hr contenteditable=&quot;false&quot; data-ke-type=&quot;horizontalRule&quot; data-ke-style=&quot;style7&quot; /&gt;
&lt;h2 data-ke-size=&quot;size26&quot;&gt;&lt;span&gt;&lt;b&gt;2. 풀이 1차&lt;/b&gt;&lt;/span&gt;&lt;/h2&gt;
&lt;ul style=&quot;list-style-type: disc;&quot; data-ke-list-type=&quot;disc&quot;&gt;
&lt;li&gt;2중 for문을 이용해서 한개의 array를 전부도는걸 여러번 반복했다.&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&lt;/li&gt;
&lt;/ul&gt;
&lt;hr contenteditable=&quot;false&quot; data-ke-type=&quot;horizontalRule&quot; data-ke-style=&quot;style7&quot; /&gt;
&lt;h2 data-ke-size=&quot;size26&quot;&gt;&lt;span&gt;&lt;b&gt;3. 코드 1차&lt;/b&gt;&lt;/span&gt;&lt;/h2&gt;
&lt;pre id=&quot;code_1625577268012&quot; class=&quot;javascript&quot; style=&quot;overflow: auto; margin: 28px auto; padding: 0px; color: #555555; background-color: #f6f7f8; overflow-wrap: break-word; font-family: Menlo, Consolas, Monaco, monospace; font-size: 14px; line-height: 20px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;&quot; data-ke-language=&quot;javascript&quot; data-ke-type=&quot;codeblock&quot;&gt;&lt;code&gt;
function solution(arr1, arr2) {
    let answer = [];
    arr1.sort();
    arr2.sort();
    var p1=0;

    while(p1&amp;lt;arr1.length){
        var p2=0
        while(p2&amp;lt;arr2.length){
            if(arr1[p1]===arr2[p2++]){
                answer.push(arr1[p1])
            }
        }
        p1++;
    }

    return answer;
}

let a = [1, 3, 9, 5, 2];
let b = [3, 2, 5, 7, 8];
console.log(solution(a, b));&lt;/code&gt;&lt;/pre&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&amp;nbsp;&lt;/p&gt;
&lt;h2 data-ke-size=&quot;size26&quot;&gt;&lt;span&gt;&lt;b&gt;2. 풀이 2차&lt;/b&gt;&lt;/span&gt;&lt;/h2&gt;
&lt;ul style=&quot;list-style-type: disc;&quot; data-ke-list-type=&quot;disc&quot;&gt;
&lt;li&gt;2포인트 알고리즘 이용&lt;/li&gt;
&lt;li&gt;정렬후 작은값의 포인터만 값을 올리고, 같으면&amp;nbsp; push해줬다&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;figure class=&quot;imageblock alignCenter&quot; data-origin-width=&quot;1280&quot; data-origin-height=&quot;801&quot; data-filename=&quot;22.jpg&quot; data-ke-mobilestyle=&quot;widthOrigin&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/FKidG/btq8WaViQwS/SAgGYGcUmybkKFK1KT0K40/img.jpg&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/FKidG/btq8WaViQwS/SAgGYGcUmybkKFK1KT0K40/img.jpg&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/FKidG/btq8WaViQwS/SAgGYGcUmybkKFK1KT0K40/img.jpg&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2FFKidG%2Fbtq8WaViQwS%2FSAgGYGcUmybkKFK1KT0K40%2Fimg.jpg&quot; data-origin-width=&quot;1280&quot; data-origin-height=&quot;801&quot; data-filename=&quot;22.jpg&quot; data-ke-mobilestyle=&quot;widthOrigin&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot;/&gt;&lt;/span&gt;&lt;/figure&gt;
&lt;/p&gt;
&lt;hr contenteditable=&quot;false&quot; data-ke-type=&quot;horizontalRule&quot; data-ke-style=&quot;style7&quot; /&gt;
&lt;h2 data-ke-size=&quot;size26&quot;&gt;&lt;span&gt;&lt;b&gt;3. 코드 2차&lt;/b&gt;&lt;/span&gt;&lt;/h2&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&amp;nbsp;&lt;/p&gt;
&lt;pre id=&quot;code_1625577268013&quot; class=&quot;javascript&quot; style=&quot;overflow: auto; margin: 28px auto; padding: 0px; color: #555555; background-color: #f6f7f8; overflow-wrap: break-word; font-family: Menlo, Consolas, Monaco, monospace; font-size: 14px; line-height: 20px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;&quot; data-ke-language=&quot;javascript&quot; data-ke-type=&quot;codeblock&quot;&gt;&lt;code&gt;
function solution(arr1, arr2) {
    let answer = [];
    arr1.sort((a,b)=&amp;gt;a-b);
    arr2.sort((a,b)=&amp;gt;a-b);
    var p1=0, p2=0;

    while(p1&amp;lt;arr1.length &amp;amp;&amp;amp; p2&amp;lt;arr2.length){
        if(arr1[p1]===arr2[p2]){
            answer.push(arr1[p1]);
            p1++;
            p2++;
        }
        else if(arr1[p1]&amp;gt;arr2[p2]){
            p2++
        }else{
            p1++
        }
    }
    

    return answer;
}

let a = [1, 3, 9, 5, 2];
let b = [3, 2, 5, 7, 8];
console.log(solution(a, b));&lt;/code&gt;&lt;/pre&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&amp;nbsp;&lt;/p&gt;</description>
      <category>Algorithm(JavaScript)</category>
      <author>류정식</author>
      <guid isPermaLink="true">https://sw-ryu.tistory.com/106</guid>
      <comments>https://sw-ryu.tistory.com/106#entry106comment</comments>
      <pubDate>Tue, 6 Jul 2021 22:16:22 +0900</pubDate>
    </item>
    <item>
      <title>[인프런] 두 배열 합치기</title>
      <link>https://sw-ryu.tistory.com/105</link>
      <description>&lt;h2 data-ke-size=&quot;size26&quot;&gt;&lt;span&gt;&lt;b&gt;0. 제목&lt;/b&gt;&lt;/span&gt;&lt;/h2&gt;
&lt;ul style=&quot;list-style-type: disc;&quot; data-ke-list-type=&quot;disc&quot;&gt;
&lt;li&gt;&lt;span&gt;두 배열 합치기&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;hr contenteditable=&quot;false&quot; data-ke-type=&quot;horizontalRule&quot; data-ke-style=&quot;style7&quot; /&gt;
&lt;h2 data-ke-size=&quot;size26&quot;&gt;&lt;span&gt;&lt;b&gt;1. 문제&lt;/b&gt;&lt;/span&gt;&lt;/h2&gt;
&lt;p&gt;&lt;figure class=&quot;imageblock alignCenter&quot; data-origin-width=&quot;1280&quot; data-origin-height=&quot;735&quot; data-filename=&quot;KakaoTalk_20210706_212158332.jpg&quot; data-ke-mobilestyle=&quot;widthOrigin&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/NK5mW/btq8ZhzQgKe/Hy50Rk3vXU5glBgAUvKSOK/img.jpg&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/NK5mW/btq8ZhzQgKe/Hy50Rk3vXU5glBgAUvKSOK/img.jpg&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/NK5mW/btq8ZhzQgKe/Hy50Rk3vXU5glBgAUvKSOK/img.jpg&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2FNK5mW%2Fbtq8ZhzQgKe%2FHy50Rk3vXU5glBgAUvKSOK%2Fimg.jpg&quot; data-origin-width=&quot;1280&quot; data-origin-height=&quot;735&quot; data-filename=&quot;KakaoTalk_20210706_212158332.jpg&quot; data-ke-mobilestyle=&quot;widthOrigin&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot;/&gt;&lt;/span&gt;&lt;/figure&gt;
&lt;/p&gt;
&lt;hr contenteditable=&quot;false&quot; data-ke-type=&quot;horizontalRule&quot; data-ke-style=&quot;style7&quot; /&gt;
&lt;h2 data-ke-size=&quot;size26&quot;&gt;&lt;span&gt;&lt;b&gt;2. 풀이 1차&lt;/b&gt;&lt;/span&gt;&lt;/h2&gt;
&lt;ul style=&quot;list-style-type: disc;&quot; data-ke-list-type=&quot;disc&quot;&gt;
&lt;li&gt;for 문으로 배열의 shift를 이용했다.&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&lt;/li&gt;
&lt;/ul&gt;
&lt;hr contenteditable=&quot;false&quot; data-ke-type=&quot;horizontalRule&quot; data-ke-style=&quot;style7&quot; /&gt;
&lt;h2 data-ke-size=&quot;size26&quot;&gt;&lt;span&gt;&lt;b&gt;3. 코드 1차&lt;/b&gt;&lt;/span&gt;&lt;/h2&gt;
&lt;pre id=&quot;code_1625574065502&quot; class=&quot;javascript&quot; style=&quot;overflow: auto; margin: 28px auto; padding: 0px; color: #555555; background-color: #f6f7f8; overflow-wrap: break-word; font-family: Menlo, Consolas, Monaco, monospace; font-size: 14px; line-height: 20px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;&quot; data-ke-language=&quot;javascript&quot; data-ke-type=&quot;codeblock&quot;&gt;&lt;code&gt;
function solution(arr1, arr2) {
    let answer = [];
    while (true) {
        var a = arr1[0];
        var b = arr2[0];
        if (arr1.length === 0) {
            answer = [...answer, ...arr2]
            break;
        } else if (arr2.length === 0) {
            answer = [...answer, ...arr1]
            break;
        }


        if (a &amp;gt;= b) {
            if (answer.includes(b) === false) {
                answer.push(arr2.shift())
            }
            else {
                arr2.shift()
            }
        }
        else {
            if (answer.includes(a) === false) {
                answer.push(arr1.shift())
            }
            else {
                arr1.shift()
            }

        }
    }




    return answer;
}

let a = [1, 3, 5];
let b = [2, 3, 6, 7, 9];
console.log(solution(a, b));&lt;/code&gt;&lt;/pre&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&amp;nbsp;&lt;/p&gt;
&lt;h2 data-ke-size=&quot;size26&quot;&gt;&lt;span&gt;&lt;b&gt;2. 풀이 2차&lt;/b&gt;&lt;/span&gt;&lt;/h2&gt;
&lt;ul style=&quot;list-style-type: disc;&quot; data-ke-list-type=&quot;disc&quot;&gt;
&lt;li&gt;2포인트 알고리즘 이용&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;figure class=&quot;imageblock alignCenter&quot; data-origin-width=&quot;1232&quot; data-origin-height=&quot;729&quot; data-filename=&quot;KakaoTalk_20210706_211357686.jpg&quot; data-ke-mobilestyle=&quot;widthOrigin&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/deouT8/btq81TLhB14/EXauHd1sGuD0Vr67qCD5SK/img.jpg&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/deouT8/btq81TLhB14/EXauHd1sGuD0Vr67qCD5SK/img.jpg&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/deouT8/btq81TLhB14/EXauHd1sGuD0Vr67qCD5SK/img.jpg&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2FdeouT8%2Fbtq81TLhB14%2FEXauHd1sGuD0Vr67qCD5SK%2Fimg.jpg&quot; data-origin-width=&quot;1232&quot; data-origin-height=&quot;729&quot; data-filename=&quot;KakaoTalk_20210706_211357686.jpg&quot; data-ke-mobilestyle=&quot;widthOrigin&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot;/&gt;&lt;/span&gt;&lt;/figure&gt;
&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;p1, p2를 이용한다.&lt;/p&gt;
&lt;hr contenteditable=&quot;false&quot; data-ke-type=&quot;horizontalRule&quot; data-ke-style=&quot;style7&quot; /&gt;
&lt;h2 data-ke-size=&quot;size26&quot;&gt;&lt;span&gt;&lt;b&gt;3. 코드 2차&lt;/b&gt;&lt;/span&gt;&lt;/h2&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&amp;nbsp;&lt;/p&gt;
&lt;pre id=&quot;code_1625574248328&quot; class=&quot;javascript&quot; style=&quot;overflow: auto; margin: 28px auto; padding: 0px; color: #555555; background-color: #f6f7f8; overflow-wrap: break-word; font-family: Menlo, Consolas, Monaco, monospace; font-size: 14px; line-height: 20px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;&quot; data-ke-language=&quot;javascript&quot; data-ke-type=&quot;codeblock&quot;&gt;&lt;code&gt;function solution(arr1, arr2) {
    let answer = [];
    var p1=0, p2=0;
    var n1=arr1.length;
    var n2=arr2.length;

    while(p1&amp;lt;n1 &amp;amp;&amp;amp; p2&amp;lt;n2){
        if(arr1[p1]&amp;gt;=arr2[p2]) answer.push(arr2[p2++])
        else answer.push(arr1[p1++])
    }
    
    while(p1&amp;lt;n1){
        answer.push(arr1[p1++])
    }
    while(p2&amp;lt;n2){
        answer.push(arr2[p2++])
    }


    return answer;
}

let a = [1, 3, 5];
let b = [2, 3, 6, 7, 9];
console.log(solution(a, b));&lt;/code&gt;&lt;/pre&gt;</description>
      <category>Algorithm(JavaScript)</category>
      <author>류정식</author>
      <guid isPermaLink="true">https://sw-ryu.tistory.com/105</guid>
      <comments>https://sw-ryu.tistory.com/105#entry105comment</comments>
      <pubDate>Tue, 6 Jul 2021 21:33:05 +0900</pubDate>
    </item>
    <item>
      <title>[프로그래머스] 문자열 압축</title>
      <link>https://sw-ryu.tistory.com/104</link>
      <description>&lt;h2 data-ke-size=&quot;size26&quot;&gt;&lt;span&gt;&lt;b&gt;0. 제목&lt;/b&gt;&lt;/span&gt;&lt;/h2&gt;
&lt;ul style=&quot;list-style-type: disc;&quot; data-ke-list-type=&quot;disc&quot;&gt;
&lt;li&gt;&lt;span&gt;프로그래머스 타겟 넘버&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;hr contenteditable=&quot;false&quot; data-ke-type=&quot;horizontalRule&quot; data-ke-style=&quot;style7&quot; /&gt;
&lt;h2 data-ke-size=&quot;size26&quot;&gt;&lt;span&gt;&lt;b&gt;1. 문제&lt;/b&gt;&lt;/span&gt;&lt;/h2&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&amp;nbsp;&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&lt;a href=&quot;https://programmers.co.kr/learn/courses/30/lessons/43165&quot; target=&quot;_blank&quot; rel=&quot;noopener&quot;&gt;https://programmers.co.kr/learn/courses/30/lessons/43165&lt;/a&gt;&lt;/p&gt;
&lt;figure id=&quot;og_1625529468629&quot; contenteditable=&quot;false&quot; data-ke-type=&quot;opengraph&quot; data-ke-align=&quot;alignCenter&quot; data-og-type=&quot;website&quot; data-og-title=&quot;코딩테스트 연습 - 타겟 넘버&quot; data-og-description=&quot;n개의 음이 아닌 정수가 있습니다. 이 수를 적절히 더하거나 빼서 타겟 넘버를 만들려고 합니다. 예를 들어 [1, 1, 1, 1, 1]로 숫자 3을 만들려면 다음 다섯 방법을 쓸 수 있습니다. -1+1+1+1+1 = 3 +1-1+1+1+&quot; data-og-host=&quot;programmers.co.kr&quot; data-og-source-url=&quot;https://programmers.co.kr/learn/courses/30/lessons/43165&quot; data-og-url=&quot;https://programmers.co.kr/learn/courses/30/lessons/43165&quot; data-og-image=&quot;https://scrap.kakaocdn.net/dn/1L1gQ/hyKN4okrmj/I9fg2dahmKKwjvsL3nMMVK/img.jpg?width=626&amp;amp;height=626&amp;amp;face=0_0_626_626,https://scrap.kakaocdn.net/dn/75aid/hyKMGWVTK9/55IbLSSS2BjlEUTPbnKh01/img.jpg?width=626&amp;amp;height=626&amp;amp;face=0_0_626_626&quot;&gt;&lt;a href=&quot;https://programmers.co.kr/learn/courses/30/lessons/43165&quot; target=&quot;_blank&quot; rel=&quot;noopener&quot; data-source-url=&quot;https://programmers.co.kr/learn/courses/30/lessons/43165&quot;&gt;
&lt;div class=&quot;og-image&quot; style=&quot;background-image: url('https://scrap.kakaocdn.net/dn/1L1gQ/hyKN4okrmj/I9fg2dahmKKwjvsL3nMMVK/img.jpg?width=626&amp;amp;height=626&amp;amp;face=0_0_626_626,https://scrap.kakaocdn.net/dn/75aid/hyKMGWVTK9/55IbLSSS2BjlEUTPbnKh01/img.jpg?width=626&amp;amp;height=626&amp;amp;face=0_0_626_626');&quot;&gt;&amp;nbsp;&lt;/div&gt;
&lt;div class=&quot;og-text&quot;&gt;
&lt;p class=&quot;og-title&quot; data-ke-size=&quot;size16&quot;&gt;코딩테스트 연습 - 타겟 넘버&lt;/p&gt;
&lt;p class=&quot;og-desc&quot; data-ke-size=&quot;size16&quot;&gt;n개의 음이 아닌 정수가 있습니다. 이 수를 적절히 더하거나 빼서 타겟 넘버를 만들려고 합니다. 예를 들어 [1, 1, 1, 1, 1]로 숫자 3을 만들려면 다음 다섯 방법을 쓸 수 있습니다. -1+1+1+1+1 = 3 +1-1+1+1+&lt;/p&gt;
&lt;p class=&quot;og-host&quot; data-ke-size=&quot;size16&quot;&gt;programmers.co.kr&lt;/p&gt;
&lt;/div&gt;
&lt;/a&gt;&lt;/figure&gt;
&lt;hr contenteditable=&quot;false&quot; data-ke-type=&quot;horizontalRule&quot; data-ke-style=&quot;style7&quot; /&gt;
&lt;h2 data-ke-size=&quot;size26&quot;&gt;&lt;span&gt;&lt;b&gt;2. 풀이&lt;/b&gt;&lt;/span&gt;&lt;/h2&gt;
&lt;ul style=&quot;list-style-type: disc;&quot; data-ke-list-type=&quot;disc&quot;&gt;
&lt;li&gt;bfs완전 탐색을 이용한다.&lt;/li&gt;
&lt;li&gt;bfs구현은 큐, 재귀함수가 있는데 재귀함수를 이용했다.&lt;/li&gt;
&lt;li&gt;재귀를 통해 1더한값과 1뺀값을 2개의 케이스로 운용한다.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;figure class=&quot;imageblock alignCenter&quot; data-origin-width=&quot;360&quot; data-origin-height=&quot;299&quot; data-filename=&quot;BFS.png&quot; data-ke-mobilestyle=&quot;widthOrigin&quot;&gt;&lt;span data-url=&quot;https://blog.kakaocdn.net/dn/c6RFPi/btq8MGACPOU/hGOgXyQvvXLPdYimD2m5xk/img.png&quot; data-phocus=&quot;https://blog.kakaocdn.net/dn/c6RFPi/btq8MGACPOU/hGOgXyQvvXLPdYimD2m5xk/img.png&quot;&gt;&lt;img src=&quot;https://blog.kakaocdn.net/dn/c6RFPi/btq8MGACPOU/hGOgXyQvvXLPdYimD2m5xk/img.png&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2Fc6RFPi%2Fbtq8MGACPOU%2FhGOgXyQvvXLPdYimD2m5xk%2Fimg.png&quot; data-origin-width=&quot;360&quot; data-origin-height=&quot;299&quot; data-filename=&quot;BFS.png&quot; data-ke-mobilestyle=&quot;widthOrigin&quot; onerror=&quot;this.onerror=null; this.src='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png'; this.srcset='//t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png';&quot;/&gt;&lt;/span&gt;&lt;/figure&gt;
&lt;/p&gt;
&lt;hr contenteditable=&quot;false&quot; data-ke-type=&quot;horizontalRule&quot; data-ke-style=&quot;style7&quot; /&gt;
&lt;h2 data-ke-size=&quot;size26&quot;&gt;&lt;span&gt;&lt;b&gt;3. 코드&lt;/b&gt;&lt;/span&gt;&lt;/h2&gt;
&lt;pre id=&quot;code_1625529445511&quot; class=&quot;javascript&quot; style=&quot;overflow: auto; margin: 28px auto; padding: 0px; color: #555555; background-color: #f6f7f8; overflow-wrap: break-word; font-family: Menlo, Consolas, Monaco, monospace; font-size: 14px; line-height: 20px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;&quot; data-ke-language=&quot;javascript&quot; data-ke-type=&quot;codeblock&quot;&gt;&lt;code&gt;function solution(numbers, target) {
    var answer = 0;
    
    
    const recursive=(count, sum)=&amp;gt;{
        if(count==numbers.length){
            if(sum==target){
                answer++;
            }
            return
        }
        recursive(count+1, sum+numbers[count])
        recursive(count+1, sum-numbers[count])
        
    }
    
    recursive(0, 0)
    return answer;
    
}&lt;/code&gt;&lt;/pre&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&amp;nbsp;&lt;/p&gt;</description>
      <category>Algorithm(JavaScript)</category>
      <author>류정식</author>
      <guid isPermaLink="true">https://sw-ryu.tistory.com/104</guid>
      <comments>https://sw-ryu.tistory.com/104#entry104comment</comments>
      <pubDate>Tue, 6 Jul 2021 08:59:44 +0900</pubDate>
    </item>
    <item>
      <title>[프로그래머스] 문자열 압축</title>
      <link>https://sw-ryu.tistory.com/103</link>
      <description>&lt;h2 data-ke-size=&quot;size26&quot;&gt;&lt;span&gt;&lt;b&gt;0. 제목&lt;/b&gt;&lt;/span&gt;&lt;/h2&gt;
&lt;ul style=&quot;list-style-type: disc;&quot; data-ke-list-type=&quot;disc&quot;&gt;
&lt;li&gt;&lt;span&gt;프로그래머스 문자열&amp;nbsp;압축&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;hr contenteditable=&quot;false&quot; data-ke-type=&quot;horizontalRule&quot; data-ke-style=&quot;style7&quot; /&gt;
&lt;h2 data-ke-size=&quot;size26&quot;&gt;&lt;span&gt;&lt;b&gt;1. 문제&lt;/b&gt;&lt;/span&gt;&lt;/h2&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&lt;a href=&quot;https://programmers.co.kr/learn/courses/30/lessons/60057&quot; target=&quot;_blank&quot; rel=&quot;noopener&quot;&gt;https://programmers.co.kr/learn/courses/30/lessons/60057&lt;/a&gt;&lt;/p&gt;
&lt;figure id=&quot;og_1625487523952&quot; contenteditable=&quot;false&quot; data-ke-type=&quot;opengraph&quot; data-ke-align=&quot;alignCenter&quot; data-og-type=&quot;website&quot; data-og-title=&quot;코딩테스트 연습 - 문자열 압축&quot; data-og-description=&quot;데이터 처리 전문가가 되고 싶은 &amp;quot;어피치&amp;quot;는 문자열을 압축하는 방법에 대해 공부를 하고 있습니다. 최근에 대량의 데이터 처리를 위한 간단한 비손실 압축 방법에 대해 공부를 하고 있는데, 문&quot; data-og-host=&quot;programmers.co.kr&quot; data-og-source-url=&quot;https://programmers.co.kr/learn/courses/30/lessons/60057&quot; data-og-url=&quot;https://programmers.co.kr/learn/courses/30/lessons/60057&quot; data-og-image=&quot;https://scrap.kakaocdn.net/dn/sN0Tn/hyKN8KOgec/KIk20vaU45Wum2hOS2knAk/img.jpg?width=626&amp;amp;height=626&amp;amp;face=0_0_626_626,https://scrap.kakaocdn.net/dn/bebaVf/hyKN2X7XXH/5KrMmBq6Wiqdoc8r0d0gfk/img.jpg?width=626&amp;amp;height=626&amp;amp;face=0_0_626_626&quot;&gt;&lt;a href=&quot;https://programmers.co.kr/learn/courses/30/lessons/60057&quot; target=&quot;_blank&quot; rel=&quot;noopener&quot; data-source-url=&quot;https://programmers.co.kr/learn/courses/30/lessons/60057&quot;&gt;
&lt;div class=&quot;og-image&quot; style=&quot;background-image: url('https://scrap.kakaocdn.net/dn/sN0Tn/hyKN8KOgec/KIk20vaU45Wum2hOS2knAk/img.jpg?width=626&amp;amp;height=626&amp;amp;face=0_0_626_626,https://scrap.kakaocdn.net/dn/bebaVf/hyKN2X7XXH/5KrMmBq6Wiqdoc8r0d0gfk/img.jpg?width=626&amp;amp;height=626&amp;amp;face=0_0_626_626');&quot;&gt;&amp;nbsp;&lt;/div&gt;
&lt;div class=&quot;og-text&quot;&gt;
&lt;p class=&quot;og-title&quot; data-ke-size=&quot;size16&quot;&gt;코딩테스트 연습 - 문자열 압축&lt;/p&gt;
&lt;p class=&quot;og-desc&quot; data-ke-size=&quot;size16&quot;&gt;데이터 처리 전문가가 되고 싶은 &quot;어피치&quot;는 문자열을 압축하는 방법에 대해 공부를 하고 있습니다. 최근에 대량의 데이터 처리를 위한 간단한 비손실 압축 방법에 대해 공부를 하고 있는데, 문&lt;/p&gt;
&lt;p class=&quot;og-host&quot; data-ke-size=&quot;size16&quot;&gt;programmers.co.kr&lt;/p&gt;
&lt;/div&gt;
&lt;/a&gt;&lt;/figure&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&amp;nbsp;&lt;/p&gt;
&lt;hr contenteditable=&quot;false&quot; data-ke-type=&quot;horizontalRule&quot; data-ke-style=&quot;style7&quot; /&gt;
&lt;h2 data-ke-size=&quot;size26&quot;&gt;&lt;span&gt;&lt;b&gt;2. 풀이&lt;/b&gt;&lt;/span&gt;&lt;/h2&gt;
&lt;ul style=&quot;list-style-type: disc;&quot; data-ke-list-type=&quot;disc&quot;&gt;
&lt;li&gt;for 문으로 1개식 2개씩... 반복하는것들 케이스마다 배열에 넣는다&lt;/li&gt;
&lt;li&gt;중복되는 값이 있으면 for문에 넣어서 몇개가 중복되는지 본다&lt;/li&gt;
&lt;li&gt;문자열 최소길이값을 출력한다.&lt;/li&gt;
&lt;/ul&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&amp;nbsp;&lt;/p&gt;
&lt;hr contenteditable=&quot;false&quot; data-ke-type=&quot;horizontalRule&quot; data-ke-style=&quot;style7&quot; /&gt;
&lt;h2 data-ke-size=&quot;size26&quot;&gt;&lt;span&gt;&lt;b&gt;3. 코드&lt;/b&gt;&lt;/span&gt;&lt;/h2&gt;
&lt;pre id=&quot;code_1625487495223&quot; class=&quot;javascript&quot; style=&quot;overflow: auto; margin: 28px auto; padding: 0px; color: #555555; background-color: #f6f7f8; overflow-wrap: break-word; font-family: Menlo, Consolas, Monaco, monospace; font-size: 14px; line-height: 20px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;&quot; data-ke-language=&quot;javascript&quot; data-ke-type=&quot;codeblock&quot;&gt;&lt;code&gt;function solution(s) {
    var answer = 0;
    let lengths = []
    let lengths_len = []
    var i = 0;

    for (i = 1; i &amp;lt; s.length + 1; i++) {

        var j = 0
        var insert = ''
        for (j = 0; j &amp;lt; s.length; j+=i) {
            var temp = 1;
            var k = 0;
            if (s.slice(j, j + i) === s.slice(j + i, j + 2 * i)) {
                for (k = j; k &amp;lt; s.length; k += i) {
                    if (s.slice(k, k + i) === s.slice(k + i, k + 2 * i)) {
                        temp += 1
                        j += i
                    }
                    else {
                        break;
                    }
                }
                insert = `${insert}${temp}${s.slice(j, j + i)}`
            }
                else{
                    insert = `${insert}${s.slice(j,j+i)}`;
                }

            }
            lengths.push(insert)
        }

        for(var z in lengths){
            lengths_len.push(lengths[z].length)
        }
    
    
        console.log(lengths_len)
        answer=Math.min.apply(null, lengths_len)
        return answer;
    }&lt;/code&gt;&lt;/pre&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&amp;nbsp;&lt;/p&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&amp;nbsp;&lt;/p&gt;
&lt;h2 data-ke-size=&quot;size26&quot;&gt;&lt;span&gt;&lt;b&gt;4. 보완할점&lt;/b&gt;&lt;/span&gt;&lt;span&gt;&lt;b&gt;&lt;/b&gt;&lt;/span&gt;&lt;/h2&gt;
&lt;ul style=&quot;list-style-type: disc;&quot; data-ke-list-type=&quot;disc&quot;&gt;
&lt;li&gt;for문을 3번 쓸 필요없을 거 같다.&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&lt;/li&gt;
&lt;/ul&gt;</description>
      <category>Algorithm(JavaScript)</category>
      <author>류정식</author>
      <guid isPermaLink="true">https://sw-ryu.tistory.com/103</guid>
      <comments>https://sw-ryu.tistory.com/103#entry103comment</comments>
      <pubDate>Mon, 5 Jul 2021 21:21:38 +0900</pubDate>
    </item>
    <item>
      <title>[프로그래머스] 124 나라의 숫자</title>
      <link>https://sw-ryu.tistory.com/102</link>
      <description>&lt;h2 data-ke-size=&quot;size26&quot;&gt;&lt;span&gt;&lt;b&gt;0. 제목&lt;/b&gt;&lt;/span&gt;&lt;/h2&gt;
&lt;ul style=&quot;list-style-type: disc;&quot; data-ke-list-type=&quot;disc&quot;&gt;
&lt;li&gt;&lt;span&gt;프로그래머스 124 나라의 숫자&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;hr style=&quot;border: none; font-size: 0px; line-height: 0; height: 20px; margin: 20px auto; background: url('https://t1.daumcdn.net/keditor/dist/0.4.0/image/divider-line.svg') 0px -160px / 200px 200px no-repeat #ffffff; cursor: pointer !important; width: 200px; color: #5c5c5c; font-family: 'Spoqa Han Sans', sans-serif; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;&quot; contenteditable=&quot;false&quot; data-ke-type=&quot;horizontalRule&quot; data-ke-style=&quot;style7&quot; /&gt;
&lt;h2 data-ke-size=&quot;size26&quot;&gt;&lt;span&gt;&lt;b&gt;1. 문제&lt;/b&gt;&lt;/span&gt;&lt;/h2&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&lt;a href=&quot;https://programmers.co.kr/learn/courses/30/lessons/12899&quot; target=&quot;_blank&quot; rel=&quot;noopener&quot;&gt;https://programmers.co.kr/learn/courses/30/lessons/12899&lt;/a&gt;&lt;/p&gt;
&lt;figure id=&quot;og_1625211927733&quot; contenteditable=&quot;false&quot; data-ke-type=&quot;opengraph&quot; data-ke-align=&quot;alignCenter&quot; data-og-type=&quot;website&quot; data-og-title=&quot;코딩테스트 연습 - 124 나라의 숫자&quot; data-og-description=&quot;&quot; data-og-host=&quot;programmers.co.kr&quot; data-og-source-url=&quot;https://programmers.co.kr/learn/courses/30/lessons/12899&quot; data-og-url=&quot;https://programmers.co.kr/learn/courses/30/lessons/12899&quot; data-og-image=&quot;https://scrap.kakaocdn.net/dn/cSSUE1/hyKLxYyjJd/9Nkq4CjCSUJX5KMPzbDXe0/img.jpg?width=626&amp;amp;height=626&amp;amp;face=0_0_626_626,https://scrap.kakaocdn.net/dn/5rf8a/hyKKLD8vSM/RdvzX3tMIsWJjgHKdr2jEK/img.jpg?width=626&amp;amp;height=626&amp;amp;face=0_0_626_626&quot;&gt;&lt;a href=&quot;https://programmers.co.kr/learn/courses/30/lessons/12899&quot; target=&quot;_blank&quot; rel=&quot;noopener&quot; data-source-url=&quot;https://programmers.co.kr/learn/courses/30/lessons/12899&quot;&gt;
&lt;div class=&quot;og-image&quot; style=&quot;background-image: url('https://scrap.kakaocdn.net/dn/cSSUE1/hyKLxYyjJd/9Nkq4CjCSUJX5KMPzbDXe0/img.jpg?width=626&amp;amp;height=626&amp;amp;face=0_0_626_626,https://scrap.kakaocdn.net/dn/5rf8a/hyKKLD8vSM/RdvzX3tMIsWJjgHKdr2jEK/img.jpg?width=626&amp;amp;height=626&amp;amp;face=0_0_626_626');&quot;&gt;&amp;nbsp;&lt;/div&gt;
&lt;div class=&quot;og-text&quot;&gt;
&lt;p class=&quot;og-title&quot; data-ke-size=&quot;size16&quot;&gt;코딩테스트 연습 - 124 나라의 숫자&lt;/p&gt;
&lt;p class=&quot;og-desc&quot; data-ke-size=&quot;size16&quot;&gt;&amp;nbsp;&lt;/p&gt;
&lt;p class=&quot;og-host&quot; data-ke-size=&quot;size16&quot;&gt;programmers.co.kr&lt;/p&gt;
&lt;/div&gt;
&lt;/a&gt;&lt;/figure&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&amp;nbsp;&lt;/p&gt;
&lt;hr style=&quot;border: none; font-size: 0px; line-height: 0; height: 20px; margin: 20px auto; background: url('https://t1.daumcdn.net/keditor/dist/0.4.0/image/divider-line.svg') 0px -160px / 200px 200px no-repeat #ffffff; cursor: pointer !important; width: 200px; color: #5c5c5c; font-family: 'Spoqa Han Sans', sans-serif; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;&quot; contenteditable=&quot;false&quot; data-ke-type=&quot;horizontalRule&quot; data-ke-style=&quot;style7&quot; /&gt;
&lt;h2 data-ke-size=&quot;size26&quot;&gt;&lt;span&gt;&lt;b&gt;2. 풀이&lt;/b&gt;&lt;/span&gt;&lt;/h2&gt;
&lt;ul style=&quot;list-style-type: disc;&quot; data-ke-list-type=&quot;disc&quot;&gt;
&lt;li&gt;결국 1, 2, 4를 반복해서 올라가는 과정이다.&lt;/li&gt;
&lt;li&gt;4, 1, 2를 3진법의 0, 1, 2에 대응한다.&lt;/li&gt;
&lt;li&gt;4일경우는 나눈몫에서 -1을 해야한다.&lt;/li&gt;
&lt;/ul&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&amp;nbsp;&lt;/p&gt;
&lt;hr style=&quot;border: none; font-size: 0px; line-height: 0; height: 20px; margin: 20px auto; background: url('https://t1.daumcdn.net/keditor/dist/0.4.0/image/divider-line.svg') 0px -160px / 200px 200px no-repeat #ffffff; cursor: pointer !important; width: 200px; color: #5c5c5c; font-family: 'Spoqa Han Sans', sans-serif; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;&quot; contenteditable=&quot;false&quot; data-ke-type=&quot;horizontalRule&quot; data-ke-style=&quot;style7&quot; /&gt;
&lt;h2 data-ke-size=&quot;size26&quot;&gt;&lt;span&gt;&lt;b&gt;3. 코드&lt;/b&gt;&lt;/span&gt;&lt;/h2&gt;
&lt;pre id=&quot;code_1625211909570&quot; class=&quot;python&quot; style=&quot;overflow: auto; margin: 28px auto; padding: 0px; color: #555555; background-color: #f6f7f8; overflow-wrap: break-word; font-family: Menlo, Consolas, Monaco, monospace; font-size: 14px; line-height: 20px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;&quot; data-ke-language=&quot;python&quot; data-ke-type=&quot;codeblock&quot;&gt;&lt;code&gt;def solution(n):
    answer = ''
    
    while n:
        n, nam=divmod(n,3)
        answer=&quot;412&quot;[nam]+answer
        if not nam:
              n -= 1
                
    return answer&lt;/code&gt;&lt;/pre&gt;</description>
      <category>Algorithm(Python)/programmers(Lv.2)</category>
      <author>류정식</author>
      <guid isPermaLink="true">https://sw-ryu.tistory.com/102</guid>
      <comments>https://sw-ryu.tistory.com/102#entry102comment</comments>
      <pubDate>Fri, 2 Jul 2021 16:46:44 +0900</pubDate>
    </item>
    <item>
      <title>[프로그래머스] 나누어 떨어지는 숫자 배열, 두 정수 사이의 합, 문자열 내 마음대로 정렬하기, 문자열 내 p와 y의 개수, 문자열 내림차순으로 배치하기, 문자열 다루기 기본, 서울에서 김서방 ..</title>
      <link>https://sw-ryu.tistory.com/101</link>
      <description>&lt;h2 data-ke-size=&quot;size26&quot;&gt;&lt;span&gt;&lt;b&gt;0. 제목&lt;/b&gt;&lt;/span&gt;&lt;/h2&gt;
&lt;ul style=&quot;list-style-type: disc;&quot; data-ke-list-type=&quot;disc&quot;&gt;
&lt;li&gt;&lt;span&gt;프로그래머스 나누어&amp;nbsp;떨어지는&amp;nbsp;숫자&amp;nbsp;배열&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span&gt;프로그래머스 두&amp;nbsp;정수&amp;nbsp;사이의&amp;nbsp;합&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span&gt;프로그래머스 문자열&amp;nbsp;내&amp;nbsp;마음대로&amp;nbsp;정렬하기&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span&gt;프로그래머스 문자열&amp;nbsp;내&amp;nbsp;p와&amp;nbsp;y의&amp;nbsp;개수&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span&gt;프로그래머스 문자열&amp;nbsp;내림차순으로&amp;nbsp;배치하기&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span&gt;프로그래머스 문자열&amp;nbsp;다루기&amp;nbsp;기본&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span&gt;프로그래머스 서울에서&amp;nbsp;김서방&amp;nbsp;찾기&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span&gt;프로그래머스 수박수박수박수박수박수&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span&gt;프로그래머스 문자열을&amp;nbsp;정수로&amp;nbsp;바꾸기&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span&gt;프로그래머스 시저&amp;nbsp;암호&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span&gt;프로그래머스 약수의&amp;nbsp;합&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span&gt;프로그래머스 자릿수&amp;nbsp;더하기&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span&gt;프로그래머스 자연수&amp;nbsp;뒤집어&amp;nbsp;배열로&amp;nbsp;만들기&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span&gt;프로그래머스 정수&amp;nbsp;내림차순으로&amp;nbsp;배치하기&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span&gt;프로그래머스 정수&amp;nbsp;제곱근&amp;nbsp;판별&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span&gt;프로그래머스 제일&amp;nbsp;작은&amp;nbsp;수&amp;nbsp;제거하기&lt;/span&gt;&lt;span&gt;&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&amp;nbsp;&lt;/p&gt;
&lt;hr style=&quot;border: none; font-size: 0px; line-height: 0; height: 20px; margin: 20px auto; background: url('https://t1.daumcdn.net/keditor/dist/0.4.0/image/divider-line.svg') 0px -160px / 200px 200px no-repeat #ffffff; cursor: pointer !important; width: 200px; color: #5c5c5c; font-family: 'Spoqa Han Sans', sans-serif; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;&quot; contenteditable=&quot;false&quot; data-ke-type=&quot;horizontalRule&quot; data-ke-style=&quot;style7&quot; /&gt;
&lt;h2 data-ke-size=&quot;size26&quot;&gt;&lt;span&gt;&lt;b&gt;1. 문제&lt;/b&gt;&lt;/span&gt;&lt;/h2&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&lt;a href=&quot;https://programmers.co.kr/learn/challenges&quot; target=&quot;_blank&quot; rel=&quot;noopener&quot;&gt;https://programmers.co.kr/learn/challenges&lt;/a&gt;&lt;/p&gt;
&lt;figure id=&quot;og_1625139870916&quot; contenteditable=&quot;false&quot; data-ke-type=&quot;opengraph&quot; data-ke-align=&quot;alignCenter&quot; data-og-type=&quot;website&quot; data-og-title=&quot;코딩테스트 연습&quot; data-og-description=&quot;기초부터 차근차근, 직접 코드를 작성해 보세요.&quot; data-og-host=&quot;programmers.co.kr&quot; data-og-source-url=&quot;https://programmers.co.kr/learn/challenges&quot; data-og-url=&quot;https://programmers.co.kr/learn/challenges&quot; data-og-image=&quot;https://scrap.kakaocdn.net/dn/dq1oJY/hyKKJZ9H9e/8tJ8XLx58wlk778myKKNXK/img.png?width=1200&amp;amp;height=630&amp;amp;face=0_0_1200_630,https://scrap.kakaocdn.net/dn/osKma/hyKKFXJAyQ/t0LRrIWrzq79tFHPnRbafk/img.png?width=1200&amp;amp;height=630&amp;amp;face=0_0_1200_630&quot;&gt;&lt;a href=&quot;https://programmers.co.kr/learn/challenges&quot; target=&quot;_blank&quot; rel=&quot;noopener&quot; data-source-url=&quot;https://programmers.co.kr/learn/challenges&quot;&gt;
&lt;div class=&quot;og-image&quot; style=&quot;background-image: url('https://scrap.kakaocdn.net/dn/dq1oJY/hyKKJZ9H9e/8tJ8XLx58wlk778myKKNXK/img.png?width=1200&amp;amp;height=630&amp;amp;face=0_0_1200_630,https://scrap.kakaocdn.net/dn/osKma/hyKKFXJAyQ/t0LRrIWrzq79tFHPnRbafk/img.png?width=1200&amp;amp;height=630&amp;amp;face=0_0_1200_630');&quot;&gt;&amp;nbsp;&lt;/div&gt;
&lt;div class=&quot;og-text&quot;&gt;
&lt;p class=&quot;og-title&quot; data-ke-size=&quot;size16&quot;&gt;코딩테스트 연습&lt;/p&gt;
&lt;p class=&quot;og-desc&quot; data-ke-size=&quot;size16&quot;&gt;기초부터 차근차근, 직접 코드를 작성해 보세요.&lt;/p&gt;
&lt;p class=&quot;og-host&quot; data-ke-size=&quot;size16&quot;&gt;programmers.co.kr&lt;/p&gt;
&lt;/div&gt;
&lt;/a&gt;&lt;/figure&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&amp;nbsp;&lt;/p&gt;
&lt;hr style=&quot;border: none; font-size: 0px; line-height: 0; height: 20px; margin: 20px auto; background: url('https://t1.daumcdn.net/keditor/dist/0.4.0/image/divider-line.svg') 0px -160px / 200px 200px no-repeat #ffffff; cursor: pointer !important; width: 200px; color: #5c5c5c; font-family: 'Spoqa Han Sans', sans-serif; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;&quot; contenteditable=&quot;false&quot; data-ke-type=&quot;horizontalRule&quot; data-ke-style=&quot;style7&quot; /&gt;
&lt;h2 data-ke-size=&quot;size26&quot;&gt;&lt;span&gt;&lt;b&gt;2. 풀이&lt;/b&gt;&lt;/span&gt;&lt;/h2&gt;
&lt;ul style=&quot;list-style-type: disc;&quot; data-ke-list-type=&quot;disc&quot;&gt;
&lt;li&gt;구현문제라서 어려운 부분은 없었다.&lt;/li&gt;
&lt;/ul&gt;
&lt;hr style=&quot;border: none; font-size: 0px; line-height: 0; height: 20px; margin: 20px auto; background: url('https://t1.daumcdn.net/keditor/dist/0.4.0/image/divider-line.svg') 0px -160px / 200px 200px no-repeat #ffffff; cursor: pointer !important; width: 200px; color: #5c5c5c; font-family: 'Spoqa Han Sans', sans-serif; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;&quot; contenteditable=&quot;false&quot; data-ke-type=&quot;horizontalRule&quot; data-ke-style=&quot;style7&quot; /&gt;
&lt;h2 data-ke-size=&quot;size26&quot;&gt;&lt;span&gt;&lt;b&gt;3. 코드&lt;/b&gt;&lt;/span&gt;&lt;/h2&gt;
&lt;ul style=&quot;list-style-type: disc;&quot; data-ke-list-type=&quot;disc&quot;&gt;
&lt;li&gt;&lt;span&gt;프로그래머스&lt;span&gt;&amp;nbsp;&lt;/span&gt;나누어&amp;nbsp;떨어지는&amp;nbsp;숫자&amp;nbsp;배열&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;pre id=&quot;code_1625139899151&quot; class=&quot;python&quot; style=&quot;overflow: auto; margin: 28px auto; padding: 0px; color: #555555; background-color: #f6f7f8; overflow-wrap: break-word; font-family: Menlo, Consolas, Monaco, monospace; font-size: 14px; line-height: 20px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;&quot; data-ke-language=&quot;python&quot; data-ke-type=&quot;codeblock&quot;&gt;&lt;code&gt;def solution(arr, divisor):
    answer = []
    
    for i in arr:
        if i%divisor==0:
            answer.append(i)
    answer.sort()
    if len(answer)==0:
        answer.append(-1)
    return answer&lt;/code&gt;&lt;/pre&gt;
&lt;ul style=&quot;list-style-type: disc;&quot; data-ke-list-type=&quot;disc&quot;&gt;
&lt;li&gt;&lt;span&gt;프로그래머스&lt;span&gt;&amp;nbsp;&lt;/span&gt;두&amp;nbsp;정수&amp;nbsp;사이의&amp;nbsp;합&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;pre id=&quot;code_1625139901566&quot; class=&quot;python&quot; style=&quot;overflow: auto; margin: 28px auto; padding: 0px; color: #555555; background-color: #f6f7f8; overflow-wrap: break-word; font-family: Menlo, Consolas, Monaco, monospace; font-size: 14px; line-height: 20px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;&quot; data-ke-language=&quot;python&quot; data-ke-type=&quot;codeblock&quot;&gt;&lt;code&gt;def solution(a, b):
    answer=0
    numbers=[]
    numbers.append(a)
    numbers.append(b)
    numbers.sort()
    
    for i in range(numbers[0], numbers[1]+1):
        answer+=i
    
    return answer&lt;/code&gt;&lt;/pre&gt;
&lt;ul style=&quot;list-style-type: disc;&quot; data-ke-list-type=&quot;disc&quot;&gt;
&lt;li&gt;&lt;span&gt;프로그래머스&lt;span&gt;&amp;nbsp;&lt;/span&gt;문자열&amp;nbsp;내&amp;nbsp;마음대로&amp;nbsp;정렬하기&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;pre id=&quot;code_1625139903433&quot; class=&quot;python&quot; style=&quot;overflow: auto; margin: 28px auto; padding: 0px; color: #555555; background-color: #f6f7f8; overflow-wrap: break-word; font-family: Menlo, Consolas, Monaco, monospace; font-size: 14px; line-height: 20px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;&quot; data-ke-language=&quot;python&quot; data-ke-type=&quot;codeblock&quot;&gt;&lt;code&gt;def solution(strings, n):
    answer = []
    
    strings.sort()
    answer=sorted(strings, key=lambda x: x[n])
    return answer&lt;/code&gt;&lt;/pre&gt;
&lt;ul style=&quot;list-style-type: disc;&quot; data-ke-list-type=&quot;disc&quot;&gt;
&lt;li&gt;&lt;span&gt;프로그래머스&lt;span&gt;&amp;nbsp;&lt;/span&gt;문자열&amp;nbsp;내&amp;nbsp;p와&amp;nbsp;y의&amp;nbsp;개수&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;pre id=&quot;code_1625139906573&quot; class=&quot;python&quot; style=&quot;overflow: auto; margin: 28px auto; padding: 0px; color: #555555; background-color: #f6f7f8; overflow-wrap: break-word; font-family: Menlo, Consolas, Monaco, monospace; font-size: 14px; line-height: 20px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;&quot; data-ke-language=&quot;python&quot; data-ke-type=&quot;codeblock&quot;&gt;&lt;code&gt;def solution(s):
    answer = True
    a=0
    b=0
    s=s.upper()
    
    for i in s:
        if i =='P':
            a+=1
        elif i=='Y':
            b+=1
        
    if a!=b:
        answer = False
    return answer&lt;/code&gt;&lt;/pre&gt;
&lt;ul style=&quot;list-style-type: disc;&quot; data-ke-list-type=&quot;disc&quot;&gt;
&lt;li&gt;&lt;span&gt;프로그래머스&lt;span&gt;&amp;nbsp;&lt;/span&gt;문자열&amp;nbsp;내림차순으로&amp;nbsp;배치하기&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;pre id=&quot;code_1625139908295&quot; class=&quot;python&quot; style=&quot;overflow: auto; margin: 28px auto; padding: 0px; color: #555555; background-color: #f6f7f8; overflow-wrap: break-word; font-family: Menlo, Consolas, Monaco, monospace; font-size: 14px; line-height: 20px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;&quot; data-ke-language=&quot;python&quot; data-ke-type=&quot;codeblock&quot;&gt;&lt;code&gt;def solution(s):
    answer = ''
    up=''
    for i in s:
        if i.isupper():
            up+=i
            s=s.replace(i, &quot;&quot;, 1)
            
    
    answer=sorted(s, reverse=True)
    up=sorted(up, reverse=True)
    
    answer=''.join(answer)
    up=''.join(up)
    
    return answer+up&lt;/code&gt;&lt;/pre&gt;
&lt;ul style=&quot;list-style-type: disc;&quot; data-ke-list-type=&quot;disc&quot;&gt;
&lt;li&gt;&lt;span&gt;프로그래머스&lt;span&gt;&amp;nbsp;&lt;/span&gt;문자열&amp;nbsp;다루기&amp;nbsp;기본&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;pre id=&quot;code_1625139910238&quot; class=&quot;python&quot; style=&quot;overflow: auto; margin: 28px auto; padding: 0px; color: #555555; background-color: #f6f7f8; overflow-wrap: break-word; font-family: Menlo, Consolas, Monaco, monospace; font-size: 14px; line-height: 20px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;&quot; data-ke-language=&quot;python&quot; data-ke-type=&quot;codeblock&quot;&gt;&lt;code&gt;def solution(s):
    answer = True
    if len(s)!=4 and len(s)!=6:
        answer=False
    if s.isdigit()==False:
        answer=False
        
    return answer&lt;/code&gt;&lt;/pre&gt;
&lt;ul style=&quot;list-style-type: disc;&quot; data-ke-list-type=&quot;disc&quot;&gt;
&lt;li&gt;&lt;span&gt;프로그래머스&lt;span&gt;&amp;nbsp;&lt;/span&gt;서울에서&amp;nbsp;김서방&amp;nbsp;찾기&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;pre id=&quot;code_1625139912084&quot; class=&quot;python&quot; style=&quot;overflow: auto; margin: 28px auto; padding: 0px; color: #555555; background-color: #f6f7f8; overflow-wrap: break-word; font-family: Menlo, Consolas, Monaco, monospace; font-size: 14px; line-height: 20px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;&quot; data-ke-language=&quot;python&quot; data-ke-type=&quot;codeblock&quot;&gt;&lt;code&gt;def solution(seoul):
    answer = ''
    for i in range(0, len(seoul)):
        if seoul[i]==&quot;Kim&quot;:
            answer=&quot;김서방은 &quot;+str(i)+&quot;에 있다&quot;
    return answer&lt;/code&gt;&lt;/pre&gt;
&lt;ul style=&quot;list-style-type: disc;&quot; data-ke-list-type=&quot;disc&quot;&gt;
&lt;li&gt;&lt;span&gt;프로그래머스&lt;span&gt;&amp;nbsp;&lt;/span&gt;수박수박수박수박수박수&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;pre id=&quot;code_1625139914063&quot; class=&quot;python&quot; style=&quot;overflow: auto; margin: 28px auto; padding: 0px; color: #555555; background-color: #f6f7f8; overflow-wrap: break-word; font-family: Menlo, Consolas, Monaco, monospace; font-size: 14px; line-height: 20px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;&quot; data-ke-language=&quot;python&quot; data-ke-type=&quot;codeblock&quot;&gt;&lt;code&gt;def solution(s):
    answer = 0
    
    answer=int(s)
    return answer&lt;/code&gt;&lt;/pre&gt;
&lt;ul style=&quot;list-style-type: disc;&quot; data-ke-list-type=&quot;disc&quot;&gt;
&lt;li&gt;&lt;span&gt;프로그래머스&lt;span&gt;&amp;nbsp;&lt;/span&gt;문자열을&amp;nbsp;정수로&amp;nbsp;바꾸기&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;pre id=&quot;code_1625139915879&quot; class=&quot;python&quot; style=&quot;overflow: auto; margin: 28px auto; padding: 0px; color: #555555; background-color: #f6f7f8; overflow-wrap: break-word; font-family: Menlo, Consolas, Monaco, monospace; font-size: 14px; line-height: 20px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;&quot; data-ke-language=&quot;python&quot; data-ke-type=&quot;codeblock&quot;&gt;&lt;code&gt;def solution(s):
    answer = 0
    
    answer=int(s)
    return answer&lt;/code&gt;&lt;/pre&gt;
&lt;ul style=&quot;list-style-type: disc;&quot; data-ke-list-type=&quot;disc&quot;&gt;
&lt;li&gt;&lt;span&gt;프로그래머스&lt;span&gt;&amp;nbsp;&lt;/span&gt;시저&amp;nbsp;암호&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;pre id=&quot;code_1625139918044&quot; class=&quot;python&quot; style=&quot;overflow: auto; margin: 28px auto; padding: 0px; color: #555555; background-color: #f6f7f8; overflow-wrap: break-word; font-family: Menlo, Consolas, Monaco, monospace; font-size: 14px; line-height: 20px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;&quot; data-ke-language=&quot;python&quot; data-ke-type=&quot;codeblock&quot;&gt;&lt;code&gt;def solution(s, n):
    answer = ''
    for i in s:
        unicodenum=0
        
        if i==' ':
            answer+=' '
        elif i.isupper():
            unicodenum=(ord(i)+n)
            if unicodenum&amp;gt;=91:
                unicodenum-=26
            
            answer+=chr(unicodenum)
        else:
            unicodenum=(ord(i)+n)
            if unicodenum&amp;gt;=123:
                unicodenum-=26
            answer+=chr(unicodenum)
            
            
    return answer&lt;/code&gt;&lt;/pre&gt;
&lt;ul style=&quot;list-style-type: disc;&quot; data-ke-list-type=&quot;disc&quot;&gt;
&lt;li&gt;&lt;span&gt;프로그래머스&lt;span&gt;&amp;nbsp;&lt;/span&gt;약수의&amp;nbsp;합&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;pre id=&quot;code_1625139920356&quot; class=&quot;python&quot; style=&quot;overflow: auto; margin: 28px auto; padding: 0px; color: #555555; background-color: #f6f7f8; overflow-wrap: break-word; font-family: Menlo, Consolas, Monaco, monospace; font-size: 14px; line-height: 20px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;&quot; data-ke-language=&quot;python&quot; data-ke-type=&quot;codeblock&quot;&gt;&lt;code&gt;def solution(n):
    answer = 0
    
    for i in range(1, n+1):
        if n%i==0:
            answer+=i
    
    return answer&lt;/code&gt;&lt;/pre&gt;
&lt;ul style=&quot;list-style-type: disc;&quot; data-ke-list-type=&quot;disc&quot;&gt;
&lt;li&gt;&lt;span&gt;프로그래머스&lt;span&gt;&amp;nbsp;&lt;/span&gt;자릿수&amp;nbsp;더하기&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;pre id=&quot;code_1625139922262&quot; class=&quot;python&quot; style=&quot;overflow: auto; margin: 28px auto; padding: 0px; color: #555555; background-color: #f6f7f8; overflow-wrap: break-word; font-family: Menlo, Consolas, Monaco, monospace; font-size: 14px; line-height: 20px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;&quot; data-ke-language=&quot;python&quot; data-ke-type=&quot;codeblock&quot;&gt;&lt;code&gt;def solution(n):
    answer = 0
    for i in str(n):
        answer+=int(i)
    
    
    return answer&lt;/code&gt;&lt;/pre&gt;
&lt;ul style=&quot;list-style-type: disc;&quot; data-ke-list-type=&quot;disc&quot;&gt;
&lt;li&gt;&lt;span&gt;프로그래머스&lt;span&gt;&amp;nbsp;&lt;/span&gt;자연수&amp;nbsp;뒤집어&amp;nbsp;배열로&amp;nbsp;만들기&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;pre id=&quot;code_1625139924253&quot; class=&quot;python&quot; style=&quot;overflow: auto; margin: 28px auto; padding: 0px; color: #555555; background-color: #f6f7f8; overflow-wrap: break-word; font-family: Menlo, Consolas, Monaco, monospace; font-size: 14px; line-height: 20px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;&quot; data-ke-language=&quot;python&quot; data-ke-type=&quot;codeblock&quot;&gt;&lt;code&gt;def solution(n):
    answer = []
    
    for i in str(n):
        answer.insert(0, int(i))
    return answer&lt;/code&gt;&lt;/pre&gt;
&lt;ul style=&quot;list-style-type: disc;&quot; data-ke-list-type=&quot;disc&quot;&gt;
&lt;li&gt;&lt;span&gt;프로그래머스&lt;span&gt;&amp;nbsp;&lt;/span&gt;정수&amp;nbsp;내림차순으로&amp;nbsp;배치하기&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;pre id=&quot;code_1625139926190&quot; class=&quot;python&quot; style=&quot;overflow: auto; margin: 28px auto; padding: 0px; color: #555555; background-color: #f6f7f8; overflow-wrap: break-word; font-family: Menlo, Consolas, Monaco, monospace; font-size: 14px; line-height: 20px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;&quot; data-ke-language=&quot;python&quot; data-ke-type=&quot;codeblock&quot;&gt;&lt;code&gt;import math
def solution(n):
    answer = 0
    a=(int(math.sqrt(n)))
    
    if a*a==n:
        answer=(a+1)*(a+1)
    else:
        answer=-1
    return answer&lt;/code&gt;&lt;/pre&gt;
&lt;ul style=&quot;list-style-type: disc;&quot; data-ke-list-type=&quot;disc&quot;&gt;
&lt;li&gt;&lt;span&gt;프로그래머스&lt;span&gt;&amp;nbsp;&lt;/span&gt;정수&amp;nbsp;제곱근&amp;nbsp;판별&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;pre id=&quot;code_1625139928067&quot; class=&quot;python&quot; style=&quot;overflow: auto; margin: 28px auto; padding: 0px; color: #555555; background-color: #f6f7f8; overflow-wrap: break-word; font-family: Menlo, Consolas, Monaco, monospace; font-size: 14px; line-height: 20px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;&quot; data-ke-language=&quot;python&quot; data-ke-type=&quot;codeblock&quot;&gt;&lt;code&gt;import math
def solution(n):
    answer = 0
    a=(int(math.sqrt(n)))
    
    if a*a==n:
        answer=(a+1)*(a+1)
    else:
        answer=-1
    return answer&lt;/code&gt;&lt;/pre&gt;
&lt;ul style=&quot;list-style-type: disc;&quot; data-ke-list-type=&quot;disc&quot;&gt;
&lt;li&gt;&lt;span&gt;프로그래머스&lt;span&gt;&amp;nbsp;&lt;/span&gt;제일&amp;nbsp;작은&amp;nbsp;수&amp;nbsp;제거하기&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;pre id=&quot;code_1625139930476&quot; class=&quot;python&quot; style=&quot;overflow: auto; margin: 28px auto; padding: 0px; color: #555555; background-color: #f6f7f8; overflow-wrap: break-word; font-family: Menlo, Consolas, Monaco, monospace; font-size: 14px; line-height: 20px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;&quot; data-ke-language=&quot;python&quot; data-ke-type=&quot;codeblock&quot;&gt;&lt;code&gt;def solution(arr):
    answer = []
    min_num=min(arr)
    arr.remove(min_num)
    if arr==[]:
        answer=[-1]
    else:
        answer=arr
    return answer&lt;/code&gt;&lt;/pre&gt;</description>
      <category>Algorithm(Python)/programmers(Lv.1)</category>
      <author>류정식</author>
      <guid isPermaLink="true">https://sw-ryu.tistory.com/101</guid>
      <comments>https://sw-ryu.tistory.com/101#entry101comment</comments>
      <pubDate>Thu, 1 Jul 2021 20:48:56 +0900</pubDate>
    </item>
    <item>
      <title>[프로그래머스] 크레인 인형뽑기 게임</title>
      <link>https://sw-ryu.tistory.com/100</link>
      <description>&lt;h2 data-ke-size=&quot;size26&quot;&gt;&lt;span&gt;&lt;b&gt;0. 제목&lt;/b&gt;&lt;/span&gt;&lt;/h2&gt;
&lt;ul style=&quot;list-style-type: disc;&quot; data-ke-list-type=&quot;disc&quot;&gt;
&lt;li&gt;&lt;span&gt;프로그래머스 크레인 인형뽑기 게임&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;hr style=&quot;border: none; font-size: 0px; line-height: 0; height: 20px; margin: 20px auto; background: url('https://t1.daumcdn.net/keditor/dist/0.4.0/image/divider-line.svg') 0px -160px / 200px 200px no-repeat #ffffff; cursor: pointer !important; width: 200px; color: #5c5c5c; font-family: 'Spoqa Han Sans', sans-serif; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;&quot; contenteditable=&quot;false&quot; data-ke-type=&quot;horizontalRule&quot; data-ke-style=&quot;style7&quot; /&gt;
&lt;h2 data-ke-size=&quot;size26&quot;&gt;&lt;span&gt;&lt;b&gt;1. 문제&lt;/b&gt;&lt;/span&gt;&lt;/h2&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&lt;a href=&quot;https://programmers.co.kr/learn/courses/30/lessons/64061&quot; target=&quot;_blank&quot; rel=&quot;noopener&quot;&gt;https://programmers.co.kr/learn/courses/30/lessons/64061&lt;/a&gt;&lt;/p&gt;
&lt;figure id=&quot;og_1624423692482&quot; contenteditable=&quot;false&quot; data-ke-type=&quot;opengraph&quot; data-ke-align=&quot;alignCenter&quot; data-og-type=&quot;website&quot; data-og-title=&quot;코딩테스트 연습 - 크레인 인형뽑기 게임&quot; data-og-description=&quot;[[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]] [1,5,3,5,1,2,1,4] 4&quot; data-og-host=&quot;programmers.co.kr&quot; data-og-source-url=&quot;https://programmers.co.kr/learn/courses/30/lessons/64061&quot; data-og-url=&quot;https://programmers.co.kr/learn/courses/30/lessons/64061&quot; data-og-image=&quot;https://scrap.kakaocdn.net/dn/xsn4g/hyKD2eXGuv/DG55NW6TrGCp53m4EBkDK0/img.jpg?width=626&amp;amp;height=626&amp;amp;face=0_0_626_626,https://scrap.kakaocdn.net/dn/o6OG4/hyKDVtovP8/rzn6cwz4Wlk2UIwZ1EJ0u1/img.jpg?width=626&amp;amp;height=626&amp;amp;face=0_0_626_626,https://scrap.kakaocdn.net/dn/HP63I/hyKDYXVANv/5a3az90PDTWSdEW8FfGZSk/img.png?width=500&amp;amp;height=500&amp;amp;face=0_0_500_500&quot;&gt;&lt;a href=&quot;https://programmers.co.kr/learn/courses/30/lessons/64061&quot; target=&quot;_blank&quot; rel=&quot;noopener&quot; data-source-url=&quot;https://programmers.co.kr/learn/courses/30/lessons/64061&quot;&gt;
&lt;div class=&quot;og-image&quot; style=&quot;background-image: url('https://scrap.kakaocdn.net/dn/xsn4g/hyKD2eXGuv/DG55NW6TrGCp53m4EBkDK0/img.jpg?width=626&amp;amp;height=626&amp;amp;face=0_0_626_626,https://scrap.kakaocdn.net/dn/o6OG4/hyKDVtovP8/rzn6cwz4Wlk2UIwZ1EJ0u1/img.jpg?width=626&amp;amp;height=626&amp;amp;face=0_0_626_626,https://scrap.kakaocdn.net/dn/HP63I/hyKDYXVANv/5a3az90PDTWSdEW8FfGZSk/img.png?width=500&amp;amp;height=500&amp;amp;face=0_0_500_500');&quot;&gt;&amp;nbsp;&lt;/div&gt;
&lt;div class=&quot;og-text&quot;&gt;
&lt;p class=&quot;og-title&quot; data-ke-size=&quot;size16&quot;&gt;코딩테스트 연습 - 크레인 인형뽑기 게임&lt;/p&gt;
&lt;p class=&quot;og-desc&quot; data-ke-size=&quot;size16&quot;&gt;[[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]] [1,5,3,5,1,2,1,4] 4&lt;/p&gt;
&lt;p class=&quot;og-host&quot; data-ke-size=&quot;size16&quot;&gt;programmers.co.kr&lt;/p&gt;
&lt;/div&gt;
&lt;/a&gt;&lt;/figure&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&amp;nbsp;&lt;/p&gt;
&lt;hr style=&quot;border: none; font-size: 0px; line-height: 0; height: 20px; margin: 20px auto; background: url('https://t1.daumcdn.net/keditor/dist/0.4.0/image/divider-line.svg') 0px -160px / 200px 200px no-repeat #ffffff; cursor: pointer !important; width: 200px; color: #5c5c5c; font-family: 'Spoqa Han Sans', sans-serif; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;&quot; contenteditable=&quot;false&quot; data-ke-type=&quot;horizontalRule&quot; data-ke-style=&quot;style7&quot; /&gt;
&lt;h2 data-ke-size=&quot;size26&quot;&gt;&lt;span&gt;&lt;b&gt;2. 풀이&lt;/b&gt;&lt;/span&gt;&lt;/h2&gt;
&lt;ul style=&quot;list-style-type: disc;&quot; data-ke-list-type=&quot;disc&quot;&gt;
&lt;li&gt;2차 리스트를 이용한다.&lt;/li&gt;
&lt;li&gt;0인&amp;nbsp; 부분은 넘긴다.&lt;/li&gt;
&lt;li&gt;뽑은 값을 새로운 리스트에 append하는데 동일하면 pop을 2번한다.&lt;/li&gt;
&lt;/ul&gt;
&lt;p data-ke-size=&quot;size16&quot;&gt;&amp;nbsp;&lt;/p&gt;
&lt;hr style=&quot;border: none; font-size: 0px; line-height: 0; height: 20px; margin: 20px auto; background: url('https://t1.daumcdn.net/keditor/dist/0.4.0/image/divider-line.svg') 0px -160px / 200px 200px no-repeat #ffffff; cursor: pointer !important; width: 200px; color: #5c5c5c; font-family: 'Spoqa Han Sans', sans-serif; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;&quot; contenteditable=&quot;false&quot; data-ke-type=&quot;horizontalRule&quot; data-ke-style=&quot;style7&quot; /&gt;
&lt;h2 data-ke-size=&quot;size26&quot;&gt;&lt;span&gt;&lt;b&gt;3. 코드&lt;/b&gt;&lt;/span&gt;&lt;/h2&gt;
&lt;pre id=&quot;code_1624423677663&quot; class=&quot;python&quot; style=&quot;overflow: auto; margin: 28px auto; padding: 0px; color: #555555; background-color: #f6f7f8; overflow-wrap: break-word; font-family: Menlo, Consolas, Monaco, monospace; font-size: 14px; line-height: 20px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;&quot; data-ke-language=&quot;python&quot; data-ke-type=&quot;codeblock&quot;&gt;&lt;code&gt;def solution(board, moves):
    answer = 0
    
    bucket=[]
    length=len(board[0])

    for i in moves:
        for k in range(0, length):
            pick=0
            if board[k][i-1]!=0:
                pick=board[k][i-1]
                board[k][i-1]=0
                break
        if pick!=0:
            bucket.append(pick)
        if len(bucket)&amp;gt;=2:
            if bucket[-1]==bucket[-2]:
                bucket.pop()
                bucket.pop()
                answer+=2
    return answer&lt;/code&gt;&lt;/pre&gt;</description>
      <category>Algorithm(Python)/programmers(Lv.1)</category>
      <author>류정식</author>
      <guid isPermaLink="true">https://sw-ryu.tistory.com/100</guid>
      <comments>https://sw-ryu.tistory.com/100#entry100comment</comments>
      <pubDate>Wed, 23 Jun 2021 13:49:06 +0900</pubDate>
    </item>
  </channel>
</rss>