<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0">
  <channel>
    <title>steady study</title>
    <link>https://kmkunk.tistory.com/</link>
    <description></description>
    <language>ko</language>
    <pubDate>Mon, 6 Jul 2026 01:34:35 +0900</pubDate>
    <generator>TISTORY</generator>
    <ttl>100</ttl>
    <managingEditor>kmkunk</managingEditor>
    <item>
      <title>[Level 2] 올바른 괄호</title>
      <link>https://kmkunk.tistory.com/312</link>
      <description>&lt;pre id=&quot;code_1649324800965&quot; class=&quot;java&quot; data-ke-language=&quot;java&quot; data-ke-type=&quot;codeblock&quot;&gt;&lt;code&gt;import java.util.*;

class Solution {
    boolean solution(String s) {
        Stack&amp;lt;Character&amp;gt; stack = new Stack&amp;lt;&amp;gt;();
        
        for(int i=0; i&amp;lt;s.length(); i++) {
            char c = s.charAt(i);
            if(c=='(') {
                stack.push(c);
            } else {
                if(stack.isEmpty()) { return false; }
                else { stack.pop(); }
            }
        }
        
        return stack.isEmpty();
    }
}&lt;/code&gt;&lt;/pre&gt;</description>
      <category>Problem Solving/Programmers</category>
      <author>kmkunk</author>
      <guid isPermaLink="true">https://kmkunk.tistory.com/312</guid>
      <comments>https://kmkunk.tistory.com/312#entry312comment</comments>
      <pubDate>Thu, 7 Apr 2022 18:46:50 +0900</pubDate>
    </item>
    <item>
      <title>[Level 2] [3차] 파일명 정렬</title>
      <link>https://kmkunk.tistory.com/311</link>
      <description>&lt;pre id=&quot;code_1649324778337&quot; class=&quot;java&quot; data-ke-language=&quot;java&quot; data-ke-type=&quot;codeblock&quot;&gt;&lt;code&gt;import java.util.*;

class Solution {
    public String[] solution(String[] files) {
        String[] answer = new String[files.length];
        String[][] file = new String[files.length][3];
        
        for(int i=0; i&amp;lt;files.length; i++) {
            int index = 0;
            int state = 0;
            for(int j=0; j&amp;lt;files[i].length(); j++) {
                char c = files[i].charAt(j);
                
                if(state==0 &amp;amp;&amp;amp; c&amp;gt;='0' &amp;amp;&amp;amp; c&amp;lt;='9') {
                    file[i][0] = files[i].substring(0, j);
                    index = j;
                    state = 1;
                }
                
                if(state==1 &amp;amp;&amp;amp; !(c&amp;gt;='0'&amp;amp;&amp;amp;c&amp;lt;='9')) {
                    file[i][1] = files[i].substring(index, j);
                    file[i][2] = files[i].substring(j, files[i].length());
                    state = 2;
                }
            }
            
            if(state == 1) {
                file[i][1] = files[i].substring(index, files[i].length());
                file[i][2] = &quot;&quot;;
            }
        }
        
        Arrays.sort(file, new Comparator&amp;lt;String[]&amp;gt;(){
            @Override
            public int compare(String[] s1, String[] s2) {
                String ss1 = s1[0].toUpperCase();
                String ss2 = s2[0].toUpperCase();
                
                if(ss1.equals(ss2)) { return Integer.parseInt(s1[1])-Integer.parseInt(s2[1]); }
                
                return ss1.compareTo(ss2);
            }
        });
        
        for(int i=0; i&amp;lt;answer.length; i++) { answer[i] = file[i][0]+file[i][1]+file[i][2]; }
        
        return answer;
    }
}&lt;/code&gt;&lt;/pre&gt;</description>
      <category>Problem Solving/Programmers</category>
      <author>kmkunk</author>
      <guid isPermaLink="true">https://kmkunk.tistory.com/311</guid>
      <comments>https://kmkunk.tistory.com/311#entry311comment</comments>
      <pubDate>Thu, 7 Apr 2022 18:46:33 +0900</pubDate>
    </item>
    <item>
      <title>[Level 2] 가장 큰 정사각형 찾기</title>
      <link>https://kmkunk.tistory.com/310</link>
      <description>&lt;pre id=&quot;code_1649324753369&quot; class=&quot;java&quot; data-ke-language=&quot;java&quot; data-ke-type=&quot;codeblock&quot;&gt;&lt;code&gt;class Solution {
    public int solution(int [][]board) {
        int answer = 0;
        int[][] dp = new int[board.length][board[0].length];
        
        for(int i=0; i&amp;lt;dp.length; i++) {
            for(int j=0; j&amp;lt;dp[0].length; j++) { dp[i][j] = board[i][j]; }
        }
        
        for(int i=1; i&amp;lt;dp.length; i++) {
            for(int j=1; j&amp;lt;dp[0].length; j++) {
                if(dp[i][j]==0) { continue; }
                if(dp[i-1][j-1]&amp;gt;0 &amp;amp;&amp;amp; dp[i][j-1]&amp;gt;0 &amp;amp;&amp;amp; dp[i-1][j]&amp;gt;0) {
                    dp[i][j] = Math.min(Math.min(dp[i][j-1], dp[i-1][j]), dp[i-1][j-1])+1;
                }
            }
        }
        
        for(int i=0; i&amp;lt;dp.length; i++ ) {
            for(int j=0; j&amp;lt;dp[0].length; j++) { answer = Math.max(answer, dp[i][j]); }
        }
        
        return answer*answer;
    }
}&lt;/code&gt;&lt;/pre&gt;</description>
      <category>Problem Solving/Programmers</category>
      <author>kmkunk</author>
      <guid isPermaLink="true">https://kmkunk.tistory.com/310</guid>
      <comments>https://kmkunk.tistory.com/310#entry310comment</comments>
      <pubDate>Thu, 7 Apr 2022 18:46:05 +0900</pubDate>
    </item>
    <item>
      <title>[Level 2] 방문 길이</title>
      <link>https://kmkunk.tistory.com/309</link>
      <description>&lt;pre id=&quot;code_1649324733511&quot; class=&quot;java&quot; data-ke-language=&quot;java&quot; data-ke-type=&quot;codeblock&quot;&gt;&lt;code&gt;import java.util.*;

class Solution {
    public int solution(String dirs) {
        int x = 0; int y = 0;
        Set&amp;lt;String&amp;gt; set = new HashSet&amp;lt;&amp;gt;();
        
        for(int i=0; i&amp;lt;dirs.length(); i++) {
            char c = dirs.charAt(i);
            String start = String.valueOf(x)+String.valueOf(y);
            String end = &quot;&quot;;
            
            if(c=='U' &amp;amp;&amp;amp; y!=5) {
                y++;
                end = String.valueOf(x)+String.valueOf(y);
                set.add(start+end); set.add(end+start);
            } else if(c=='D' &amp;amp;&amp;amp; y!=-5) {
                y--;
                end = String.valueOf(x)+String.valueOf(y);
                set.add(start+end); set.add(end+start);
            } else if(c=='L' &amp;amp;&amp;amp; x!=-5) {
                x--;
                end = String.valueOf(x)+String.valueOf(y);
                set.add(start+end); set.add(end+start);
            } else if(c=='R' &amp;amp;&amp;amp; x!=5) {
                x++;
                end = String.valueOf(x)+String.valueOf(y);
                set.add(start+end); set.add(end+start);
            }
        }
        
        return set.size()/2;
    }
}&lt;/code&gt;&lt;/pre&gt;</description>
      <category>Problem Solving/Programmers</category>
      <author>kmkunk</author>
      <guid isPermaLink="true">https://kmkunk.tistory.com/309</guid>
      <comments>https://kmkunk.tistory.com/309#entry309comment</comments>
      <pubDate>Thu, 7 Apr 2022 18:45:42 +0900</pubDate>
    </item>
    <item>
      <title>[Level 2] 스킬트리</title>
      <link>https://kmkunk.tistory.com/308</link>
      <description>&lt;pre id=&quot;code_1649324707882&quot; class=&quot;java&quot; data-ke-language=&quot;java&quot; data-ke-type=&quot;codeblock&quot;&gt;&lt;code&gt;import java.util.*;

class Solution {
    public int solution(String skill, String[] skill_trees) {
        int answer = 0;
        List&amp;lt;Character&amp;gt; list = new ArrayList&amp;lt;&amp;gt;();
        
        for(int i=0; i&amp;lt;skill.length(); i++) { list.add(skill.charAt(i)); }
        
        for(String s : skill_trees) {
            int index = 0;
            boolean check = true;
            
            for(int i=0; i&amp;lt;s.length(); i++) {
                char c = s.charAt(i);
                if(list.contains(c)) {
                    if(list.get(index)==c) {
                        index++;
                        continue;
                    } else {
                        check = false;
                        break;
                    }
                }
            }
            
            answer += check ? 1 : 0;
        }
        
        return answer;
    }
}&lt;/code&gt;&lt;/pre&gt;</description>
      <category>Problem Solving/Programmers</category>
      <author>kmkunk</author>
      <guid isPermaLink="true">https://kmkunk.tistory.com/308</guid>
      <comments>https://kmkunk.tistory.com/308#entry308comment</comments>
      <pubDate>Thu, 7 Apr 2022 18:45:21 +0900</pubDate>
    </item>
    <item>
      <title>[Level 2] n^2 배열 자르기</title>
      <link>https://kmkunk.tistory.com/307</link>
      <description>&lt;pre id=&quot;code_1649324669879&quot; class=&quot;java&quot; data-ke-language=&quot;java&quot; data-ke-type=&quot;codeblock&quot;&gt;&lt;code&gt;class Solution {
    public int[] solution(int n, long left, long right) {
        int len = (int)(right-left+1);
        int[] answer = new int[len];
        
        for(int i=0; i&amp;lt;answer.length; i++) {
            int x = (int)(left/n);
            int y = (int)(left%n);
            answer[i] = Math.max(x, y)+1;
            left++;
        }
        
        return answer;
    }
}&lt;/code&gt;&lt;/pre&gt;</description>
      <category>Problem Solving/Programmers</category>
      <author>kmkunk</author>
      <guid isPermaLink="true">https://kmkunk.tistory.com/307</guid>
      <comments>https://kmkunk.tistory.com/307#entry307comment</comments>
      <pubDate>Thu, 7 Apr 2022 18:44:51 +0900</pubDate>
    </item>
    <item>
      <title>[Level 2] 점프와 순간 이동</title>
      <link>https://kmkunk.tistory.com/306</link>
      <description>&lt;pre id=&quot;code_1649324640194&quot; class=&quot;java&quot; data-ke-language=&quot;java&quot; data-ke-type=&quot;codeblock&quot;&gt;&lt;code&gt;import java.util.*;

public class Solution {
    public int solution(int n) {
        return dp(n);
    }
    
    public int dp(int n) {
        if(n==1) {
            return 1;
        }
        
        if(n%2==0) { return dp(n/2); }
        else { return dp(n-1)+1; }
    }
}&lt;/code&gt;&lt;/pre&gt;</description>
      <category>Problem Solving/Programmers</category>
      <author>kmkunk</author>
      <guid isPermaLink="true">https://kmkunk.tistory.com/306</guid>
      <comments>https://kmkunk.tistory.com/306#entry306comment</comments>
      <pubDate>Thu, 7 Apr 2022 18:44:15 +0900</pubDate>
    </item>
    <item>
      <title>[Level 2] 이진 변환 반복하기</title>
      <link>https://kmkunk.tistory.com/305</link>
      <description>&lt;pre id=&quot;code_1649324582658&quot; class=&quot;java&quot; data-ke-language=&quot;java&quot; data-ke-type=&quot;codeblock&quot;&gt;&lt;code&gt;class Solution {
    public int count = 0;
    public int zero = 0;
    
    public int[] solution(String s) {
        int[] answer = new int[2];
        
        while(!s.equals(&quot;1&quot;)) {
            s = deleteZero(s);
            count++;
        }
        
        answer[0] = count;
        answer[1] = zero;
        
        return answer;
    }
    
    public String deleteZero(String s) {
        String temp = &quot;&quot;;
        
        for(int i=0; i&amp;lt;s.length(); i++) {
            if(s.charAt(i)=='0') { zero++; }
            else { temp += &quot;1&quot;; }
        }
        
        return Integer.toBinaryString(temp.length());
    }
}&lt;/code&gt;&lt;/pre&gt;</description>
      <category>Problem Solving/Programmers</category>
      <author>kmkunk</author>
      <guid isPermaLink="true">https://kmkunk.tistory.com/305</guid>
      <comments>https://kmkunk.tistory.com/305#entry305comment</comments>
      <pubDate>Thu, 7 Apr 2022 18:43:40 +0900</pubDate>
    </item>
    <item>
      <title>[Level 2] 게임 맵 최단거리</title>
      <link>https://kmkunk.tistory.com/304</link>
      <description>&lt;pre id=&quot;code_1649296798910&quot; class=&quot;java&quot; data-ke-language=&quot;java&quot; data-ke-type=&quot;codeblock&quot;&gt;&lt;code&gt;import java.util.*;

class Solution {
    public int n;
    public int m;
    public int[] dx = new int[]{1,-1,0,0};
    public int[] dy = new int[]{0,0,1,-1};
    public int[][] copy;
    
    public int solution(int[][] maps) {
        n = maps.length;
        m = maps[0].length;
        copy = new int[n][m];
        
        for(int i=0; i&amp;lt;n; i++) {
            for(int j=0; j&amp;lt;m; j++) { copy[i][j] = maps[i][j]; }
        }
        
        bfs(0,0);
        
        return copy[n-1][m-1]==1 ? -1 : copy[n-1][m-1];
    }
    
    public void bfs(int i, int j) {
        Queue&amp;lt;int[]&amp;gt; queue = new LinkedList&amp;lt;&amp;gt;();
        queue.add(new int[]{i,j});
        
        while(!queue.isEmpty()) {
            int[] a = queue.poll();
            int x = a[1];
            int y = a[0];
            for(int k=0; k&amp;lt;4; k++) {
                int nx = x+dx[k];
                int ny = y+dy[k];
                if(nx&amp;gt;=0 &amp;amp;&amp;amp; ny&amp;gt;=0 &amp;amp;&amp;amp; nx&amp;lt;m &amp;amp;&amp;amp; ny&amp;lt;n &amp;amp;&amp;amp; copy[ny][nx]==1) {
                    queue.add(new int[]{ny,nx});
                    copy[ny][nx] = copy[y][x]+1;
                }
            }
        }
    }
}&lt;/code&gt;&lt;/pre&gt;</description>
      <category>Problem Solving/Programmers</category>
      <author>kmkunk</author>
      <guid isPermaLink="true">https://kmkunk.tistory.com/304</guid>
      <comments>https://kmkunk.tistory.com/304#entry304comment</comments>
      <pubDate>Thu, 7 Apr 2022 10:59:59 +0900</pubDate>
    </item>
    <item>
      <title>[Level 2] 카카오프렌즈 컬러링북</title>
      <link>https://kmkunk.tistory.com/303</link>
      <description>&lt;pre id=&quot;code_1649296745980&quot; class=&quot;java&quot; data-ke-language=&quot;java&quot; data-ke-type=&quot;codeblock&quot;&gt;&lt;code&gt;import java.util.*;

class Solution {
    public boolean[][] visited;
    public int[] dx = new int[]{0,0,1,-1};
    public int[] dy = new int[]{1,-1,0,0};
    
    public int[] solution(int m, int n, int[][] picture) {
        visited = new boolean[m][n];
        int[] answer = new int[2];
        
        for(int i=0; i&amp;lt;m; i++) {
            for(int j=0; j&amp;lt;n; j++) {
                if(!visited[i][j] &amp;amp;&amp;amp; picture[i][j]&amp;gt;0) {
                    answer[1] = Math.max(bfs(i,j,m,n,picture),answer[1]);
                    answer[0]++;
                }
            }
        }
        
        return answer;
    }
    
    public int bfs(int i, int j, int m, int n, int[][] picture) {
        Queue&amp;lt;int[]&amp;gt; queue = new LinkedList&amp;lt;&amp;gt;();
        queue.add(new int[]{i,j});
        visited[i][j] = true;
        int count = 1;
        
        while(!queue.isEmpty()) {
            int[] a = queue.poll();
            int x = a[1];
            int y= a[0];
            for(int k=0; k&amp;lt;4; k++) {
                int nx = x+dx[k];
                int ny = y+dy[k];
                if(nx&amp;gt;=0 &amp;amp;&amp;amp; ny&amp;gt;=0 &amp;amp;&amp;amp; nx&amp;lt;n &amp;amp;&amp;amp; ny&amp;lt;m &amp;amp;&amp;amp; !visited[ny][nx] &amp;amp;&amp;amp; picture[ny][nx]==picture[i][j]) {
                    queue.add(new int[]{ny,nx});
                    visited[ny][nx] = true;
                    count++;
                }
            }
        }
        
        return count;
    }
}&lt;/code&gt;&lt;/pre&gt;</description>
      <category>Problem Solving/Programmers</category>
      <author>kmkunk</author>
      <guid isPermaLink="true">https://kmkunk.tistory.com/303</guid>
      <comments>https://kmkunk.tistory.com/303#entry303comment</comments>
      <pubDate>Thu, 7 Apr 2022 10:59:34 +0900</pubDate>
    </item>
    <item>
      <title>[Level 2] 모음 사전</title>
      <link>https://kmkunk.tistory.com/302</link>
      <description>&lt;pre id=&quot;code_1649217360991&quot; class=&quot;java&quot; data-ke-language=&quot;java&quot; data-ke-type=&quot;codeblock&quot;&gt;&lt;code&gt;class Solution {
    public int solution(String word) {
        int answer = word.length();
        String s = &quot;AEIOU&quot;;
        int[] n = new int[]{781, 156, 31, 6, 1};
        
        for(int i=0; i&amp;lt;word.length(); i++) {
            answer += n[i]*s.indexOf(String.valueOf(word.charAt(i)));
        }
        
        return answer;
    }
}&lt;/code&gt;&lt;/pre&gt;</description>
      <category>Problem Solving/Programmers</category>
      <author>kmkunk</author>
      <guid isPermaLink="true">https://kmkunk.tistory.com/302</guid>
      <comments>https://kmkunk.tistory.com/302#entry302comment</comments>
      <pubDate>Wed, 6 Apr 2022 12:56:10 +0900</pubDate>
    </item>
    <item>
      <title>[Level 2] 교점에 별 만들기</title>
      <link>https://kmkunk.tistory.com/301</link>
      <description>&lt;pre id=&quot;code_1649217322424&quot; class=&quot;java&quot; data-ke-language=&quot;java&quot; data-ke-type=&quot;codeblock&quot;&gt;&lt;code&gt;import java.util.*;

class Solution {
    public String[] solution(int[][] line) {
        List&amp;lt;Long&amp;gt; xl = new ArrayList&amp;lt;&amp;gt;(); List&amp;lt;Long&amp;gt; yl = new ArrayList&amp;lt;&amp;gt;();
        long xMax = Long.MIN_VALUE; long xMin = Long.MAX_VALUE;
        long yMax = Long.MIN_VALUE; long yMin = Long.MAX_VALUE;
        
        for(int i=0; i&amp;lt;line.length; i++) {
            for(int j=0; j&amp;lt;i; j++) {
                long a = line[i][0]; long b = line[i][1]; long e = line[i][2];
                long c = line[j][0]; long d = line[j][1]; long f = line[j][2];
                double x = (double)(b*f-e*d)/(a*d-b*c); double y = (double)(e*c-a*f)/(a*d-b*c);
                
                if(check(x,y)) { xl.add((long)x); yl.add((long)y); }
            }
        }
        
        for(int i=0; i&amp;lt;xl.size(); i++) {
            xMax = Math.max(xMax, xl.get(i)); xMin = Math.min(xMin, xl.get(i));
            yMax = Math.max(yMax, yl.get(i)); yMin = Math.min(yMin, yl.get(i));
        }
        
        String[] answer = new String[(int)(yMax-yMin+1)];
        
        for(int i=0; i&amp;lt;answer.length; i++) {
            answer[i] = &quot;&quot;;
            for(long j=xMin; j&amp;lt;=xMax; j++) { answer[i] += &quot;.&quot;; }
        }
        
        for(int i=0; i&amp;lt;xl.size(); i++) {
            int x = (int)(xl.get(i)-xMin); int y = (int)(yMax-yl.get(i));
            StringBuilder sb = new StringBuilder(answer[y]);
            
            sb.setCharAt(x, '*');
            answer[y] = sb.toString();
        }
        
        return answer;
    }
    
    public boolean check(double x, double y) {
        if(x==(long)x &amp;amp;&amp;amp; y==(long)y) { return true; }
        else { return false; }
    }
}&lt;/code&gt;&lt;/pre&gt;</description>
      <category>Problem Solving/Programmers</category>
      <author>kmkunk</author>
      <guid isPermaLink="true">https://kmkunk.tistory.com/301</guid>
      <comments>https://kmkunk.tistory.com/301#entry301comment</comments>
      <pubDate>Wed, 6 Apr 2022 12:55:42 +0900</pubDate>
    </item>
    <item>
      <title>[Level 2] 구명보트</title>
      <link>https://kmkunk.tistory.com/300</link>
      <description>&lt;pre id=&quot;code_1649217274016&quot; class=&quot;java&quot; data-ke-language=&quot;java&quot; data-ke-type=&quot;codeblock&quot;&gt;&lt;code&gt;import java.util.*;

class Solution {
    public int solution(int[] people, int limit) {
        int answer = 0;
        int start = 0;
        int end = people.length-1;
        
        Arrays.sort(people);
        
        while(start&amp;lt;=end) {
            start += people[start]+people[end]&amp;lt;=limit ? 1 : 0;
            end--;
            answer++;
        }
        
        return answer;
    }
}&lt;/code&gt;&lt;/pre&gt;</description>
      <category>Problem Solving/Programmers</category>
      <author>kmkunk</author>
      <guid isPermaLink="true">https://kmkunk.tistory.com/300</guid>
      <comments>https://kmkunk.tistory.com/300#entry300comment</comments>
      <pubDate>Wed, 6 Apr 2022 12:54:43 +0900</pubDate>
    </item>
    <item>
      <title>[Level 2] 주식가격</title>
      <link>https://kmkunk.tistory.com/299</link>
      <description>&lt;pre id=&quot;code_1649217230419&quot; class=&quot;java&quot; data-ke-language=&quot;java&quot; data-ke-type=&quot;codeblock&quot;&gt;&lt;code&gt;import java.util.*;

class Solution {
    public int[] solution(int[] prices) {
        int[] answer = new int[prices.length];
        Stack&amp;lt;Integer&amp;gt; stack = new Stack&amp;lt;&amp;gt;();
        
        for(int i=0; i&amp;lt;prices.length; i++) {
            while(!stack.isEmpty() &amp;amp;&amp;amp; prices[stack.peek()]&amp;gt;prices[i]) {
                int index = stack.peek();
                answer[index] = i-index;
                stack.pop();                
            }
            
            stack.push(i);
        }
        
        while(!stack.isEmpty()) {
            int index = stack.peek();
            answer[index] = prices.length-1-index;
            stack.pop();
        }
        
        return answer;
    }
}&lt;/code&gt;&lt;/pre&gt;</description>
      <category>Problem Solving/Programmers</category>
      <author>kmkunk</author>
      <guid isPermaLink="true">https://kmkunk.tistory.com/299</guid>
      <comments>https://kmkunk.tistory.com/299#entry299comment</comments>
      <pubDate>Wed, 6 Apr 2022 12:54:06 +0900</pubDate>
    </item>
    <item>
      <title>[Level 2] 영어 끝말잇기</title>
      <link>https://kmkunk.tistory.com/298</link>
      <description>&lt;pre id=&quot;code_1649217212140&quot; class=&quot;java&quot; data-ke-language=&quot;java&quot; data-ke-type=&quot;codeblock&quot;&gt;&lt;code&gt;import java.util.*;

class Solution {
    public int[] solution(int n, String[] words) {
        int[] answer = new int[2];
        List&amp;lt;String&amp;gt; list = new ArrayList&amp;lt;&amp;gt;();
        list.add(words[0]);
        
        for(int i=1; i&amp;lt;words.length; i++) {
            String w1 = words[i-1];
            String w2 = words[i];
            
            if(w1.charAt(w1.length()-1)!=w2.charAt(0) || list.contains(w2)) {
                answer[0] = i%n+1;
                answer[1] = i/n+1;
                break;
            }
            
            list.add(w2);
        }
        
        return answer;
    }
}&lt;/code&gt;&lt;/pre&gt;</description>
      <category>Problem Solving/Programmers</category>
      <author>kmkunk</author>
      <guid isPermaLink="true">https://kmkunk.tistory.com/298</guid>
      <comments>https://kmkunk.tistory.com/298#entry298comment</comments>
      <pubDate>Wed, 6 Apr 2022 12:53:41 +0900</pubDate>
    </item>
    <item>
      <title>[Level 2] 삼각 달팽이</title>
      <link>https://kmkunk.tistory.com/297</link>
      <description>&lt;pre id=&quot;code_1649217172397&quot; class=&quot;java&quot; data-ke-language=&quot;java&quot; data-ke-type=&quot;codeblock&quot;&gt;&lt;code&gt;class Solution {
    public int[] solution(int n) {
        int[] answer = new int[n*(n+1)/2];
        int[][] arr = new int[n][n];
        int x = -1;
        int y = 0;
        int len = n;
        int value = 1;
        int index = 0;
        
        while(true) {
            //down
            for(int i=0; i&amp;lt;len; i++) { arr[x+1+i][y] = value++; }
            x += len;
            len--;
            if(len==0) { break; }
            
            //right
            for(int i=0; i&amp;lt;len; i++) { arr[x][y+1+i] = value++; }
            y += len;
            len--;
            if(len==0) { break; }
            
            //diagonal
            for(int i=0; i&amp;lt;len; i++) { arr[x-1-i][y-1-i] = value++; }
            x -= len;
            y -= len;
            len--;
            if(len==0) { break; }
        }
        
        for(int i=0; i&amp;lt;n; i++) {
            for(int j=0; j&amp;lt;=i; j++) { answer[index++] = arr[i][j]; }
        }
        
        return answer;
    }
}&lt;/code&gt;&lt;/pre&gt;</description>
      <category>Problem Solving/Programmers</category>
      <author>kmkunk</author>
      <guid isPermaLink="true">https://kmkunk.tistory.com/297</guid>
      <comments>https://kmkunk.tistory.com/297#entry297comment</comments>
      <pubDate>Wed, 6 Apr 2022 12:53:19 +0900</pubDate>
    </item>
    <item>
      <title>[Level 2] 2개 이하로 다른 비트</title>
      <link>https://kmkunk.tistory.com/296</link>
      <description>&lt;pre id=&quot;code_1649217148107&quot; class=&quot;java&quot; data-ke-language=&quot;java&quot; data-ke-type=&quot;codeblock&quot;&gt;&lt;code&gt;class Solution {
    public long[] solution(long[] numbers) {
        long[] answer = new long[numbers.length];
        
        for(int i=0; i&amp;lt;numbers.length; i++) {
            if(numbers[i]%2==0) { answer[i] = numbers[i]+1; }
            else {
                String[] arr = Long.toBinaryString(numbers[i]).split(&quot;&quot;);
                String s = &quot;&quot;;
                int k = -1;
                
                for(int j=0; j&amp;lt;arr.length; j++) {
                    if(arr[j].equals(&quot;0&quot;)) { k = j; }
                }
                
                if(k==-1) {
                    s = &quot;10&quot;;
                    for(int j=0; j&amp;lt;arr.length-1; j++) { s += &quot;1&quot;; }
                } else {
                    arr[k] = &quot;1&quot;; arr[k+1] = &quot;0&quot;;
                    for(int j=0; j&amp;lt;arr.length; j++) { s += arr[j]; }
                }
                
                answer[i] = Long.valueOf(s, 2);
            }
        }
        
        return answer;
    }
}&lt;/code&gt;&lt;/pre&gt;</description>
      <category>Problem Solving/Programmers</category>
      <author>kmkunk</author>
      <guid isPermaLink="true">https://kmkunk.tistory.com/296</guid>
      <comments>https://kmkunk.tistory.com/296#entry296comment</comments>
      <pubDate>Wed, 6 Apr 2022 12:52:40 +0900</pubDate>
    </item>
    <item>
      <title>[Level 2] 피로도</title>
      <link>https://kmkunk.tistory.com/295</link>
      <description>&lt;pre id=&quot;code_1649217093058&quot; class=&quot;java&quot; data-ke-language=&quot;java&quot; data-ke-type=&quot;codeblock&quot;&gt;&lt;code&gt;class Solution {
    public boolean[] visited;
    public int answer = 0;
    
    public int solution(int k, int[][] dungeons) {
        visited = new boolean[dungeons.length];
        
        recur(0, k, dungeons, 0);
        
        return answer;
    }
    
    public void recur(int index, int k, int[][] dungeons, int count) {
        if(index==dungeons.length) {
            answer = Math.max(answer, count);
            
            return;
        }
        
        for(int i=0; i&amp;lt;dungeons.length; i++) {
            if(!visited[i] || k&amp;gt;=dungeons[i][0]) {
                visited[i] = true;
                recur(index+1, k-dungeons[i][1], dungeons, count+1);
                recur(index+1, k, dungeons, count);
                visited[i] = false;
            }
        }
    }
}&lt;/code&gt;&lt;/pre&gt;</description>
      <category>Problem Solving/Programmers</category>
      <author>kmkunk</author>
      <guid isPermaLink="true">https://kmkunk.tistory.com/295</guid>
      <comments>https://kmkunk.tistory.com/295#entry295comment</comments>
      <pubDate>Wed, 6 Apr 2022 12:52:17 +0900</pubDate>
    </item>
    <item>
      <title>[Level 2] 큰 수 만들기</title>
      <link>https://kmkunk.tistory.com/294</link>
      <description>&lt;pre id=&quot;code_1649217067610&quot; class=&quot;java&quot; data-ke-language=&quot;java&quot; data-ke-type=&quot;codeblock&quot;&gt;&lt;code&gt;class Solution {
    public String solution(String number, int k) {
        String answer = &quot;&quot;;
        int len = number.length()-k;
        
        for(int i=0; i&amp;lt;number.length(); i++) {
            if(answer.length()==len) { break; }
            if(k==0) { return answer+number.substring(i, number.length()); }
            
            char c = number.charAt(i);
            boolean delete = true;
            
            for(int j=i+1; j&amp;lt;=i+k; j++) {
                if(c&amp;lt;number.charAt(j)) {
                    delete = false;
                    k--;
                    break;
                }
            }
            
            if(delete) { answer += String.valueOf(c); }
        }
        
        return answer;
    }
}&lt;/code&gt;&lt;/pre&gt;</description>
      <category>Problem Solving/Programmers</category>
      <author>kmkunk</author>
      <guid isPermaLink="true">https://kmkunk.tistory.com/294</guid>
      <comments>https://kmkunk.tistory.com/294#entry294comment</comments>
      <pubDate>Wed, 6 Apr 2022 12:51:17 +0900</pubDate>
    </item>
    <item>
      <title>[Level 2] 카펫</title>
      <link>https://kmkunk.tistory.com/293</link>
      <description>&lt;pre id=&quot;code_1649212032328&quot; class=&quot;java&quot; data-ke-language=&quot;java&quot; data-ke-type=&quot;codeblock&quot;&gt;&lt;code&gt;class Solution {
    public int[] solution(int brown, int yellow) {
        int[] answer = new int[2];

        for(int i=3; i&amp;lt;=(brown-2)/2; i++) {
            if(i==(double)(brown+yellow)/((brown/2)-i+2)) {
                answer[0] = (brown+yellow)/i;
                answer[1] = i;
                break;
            }
        }
        
        return answer;
    }
}&lt;/code&gt;&lt;/pre&gt;</description>
      <category>Problem Solving/Programmers</category>
      <author>kmkunk</author>
      <guid isPermaLink="true">https://kmkunk.tistory.com/293</guid>
      <comments>https://kmkunk.tistory.com/293#entry293comment</comments>
      <pubDate>Wed, 6 Apr 2022 11:27:22 +0900</pubDate>
    </item>
    <item>
      <title>[Level 2] H-Index</title>
      <link>https://kmkunk.tistory.com/292</link>
      <description>&lt;pre id=&quot;code_1649211970279&quot; class=&quot;java&quot; data-ke-language=&quot;java&quot; data-ke-type=&quot;codeblock&quot;&gt;&lt;code&gt;import java.util.*;

class Solution {
    public int solution(int[] citations) {
        int answer = 0;
        
        Arrays.sort(citations);
        
        for(int i=0; i&amp;lt;=citations.length; i++) {
            for(int j=0; j&amp;lt;citations.length; j++) {
                if(citations[j]&amp;gt;=i &amp;amp;&amp;amp; citations.length-j&amp;gt;=i) {
                    answer = i;
                    break;
                }
            }
        }
        
        return answer;
    }
}&lt;/code&gt;&lt;/pre&gt;</description>
      <category>Problem Solving/Programmers</category>
      <author>kmkunk</author>
      <guid isPermaLink="true">https://kmkunk.tistory.com/292</guid>
      <comments>https://kmkunk.tistory.com/292#entry292comment</comments>
      <pubDate>Wed, 6 Apr 2022 11:26:24 +0900</pubDate>
    </item>
    <item>
      <title>[Level 2] 다리를 지나는 트럭</title>
      <link>https://kmkunk.tistory.com/291</link>
      <description>&lt;pre id=&quot;code_1649211948172&quot; class=&quot;java&quot; data-ke-language=&quot;java&quot; data-ke-type=&quot;codeblock&quot;&gt;&lt;code&gt;import java.util.*;

class Solution {
    public int solution(int bridge_length, int weight, int[] truck_weights) {
        int answer = 0;
        int sum = 0;
        Queue&amp;lt;Integer&amp;gt; queue = new LinkedList&amp;lt;&amp;gt;();
        
        for(int i=0; i&amp;lt;truck_weights.length; i++) {
            if(queue.isEmpty()) {
                sum += truck_weights[i];
                queue.add(truck_weights[i]);
                answer++;
                continue;
            }
            
            while(true) {
                if(queue.size()==bridge_length) { sum -= queue.poll(); }

                if(sum+truck_weights[i]&amp;gt;weight) {
                    queue.add(0);
                    answer++;
                } else {
                    sum += truck_weights[i];
                    queue.add(truck_weights[i]);
                    answer++;
                    break;
                }
            }
        }
        
        return answer+bridge_length;
    }
}&lt;/code&gt;&lt;/pre&gt;</description>
      <category>Problem Solving/Programmers</category>
      <author>kmkunk</author>
      <guid isPermaLink="true">https://kmkunk.tistory.com/291</guid>
      <comments>https://kmkunk.tistory.com/291#entry291comment</comments>
      <pubDate>Wed, 6 Apr 2022 11:25:57 +0900</pubDate>
    </item>
    <item>
      <title>[Level 2] 위장</title>
      <link>https://kmkunk.tistory.com/290</link>
      <description>&lt;pre id=&quot;code_1649211875477&quot; class=&quot;java&quot; data-ke-language=&quot;java&quot; data-ke-type=&quot;codeblock&quot;&gt;&lt;code&gt;import java.util.*;

class Solution {
    public int solution(String[][] clothes) {
        int answer = 1;
        Map&amp;lt;String, Integer&amp;gt; map = new HashMap&amp;lt;&amp;gt;();
        
        for(int i=0; i&amp;lt;clothes.length; i++) { map.put(clothes[i][1], 1); }
        for(int i=0; i&amp;lt;clothes.length; i++) {
            int value = map.get(clothes[i][1])+1;
            map.put(clothes[i][1], value);
        }
        
        for(int i : map.values()) { answer *= i; }
        
        return answer-1;
    }
}&lt;/code&gt;&lt;/pre&gt;</description>
      <category>Problem Solving/Programmers</category>
      <author>kmkunk</author>
      <guid isPermaLink="true">https://kmkunk.tistory.com/290</guid>
      <comments>https://kmkunk.tistory.com/290#entry290comment</comments>
      <pubDate>Wed, 6 Apr 2022 11:25:38 +0900</pubDate>
    </item>
    <item>
      <title>[Level 2] 괄호 회전하기</title>
      <link>https://kmkunk.tistory.com/289</link>
      <description>&lt;pre id=&quot;code_1649211843216&quot; class=&quot;java&quot; data-ke-language=&quot;java&quot; data-ke-type=&quot;codeblock&quot;&gt;&lt;code&gt;import java.util.*;

class Solution {
    public int solution(String s) {
        int answer = 0;
        int len = s.length();
        
        for(int i=0; i&amp;lt;len; i++) {
            Stack&amp;lt;Character&amp;gt; stack = new Stack&amp;lt;&amp;gt;();
            for(int j=0; j&amp;lt;len; j++) {
                char c = s.charAt(j);
                
                if(c=='[' || c=='(' || c=='{') { stack.push(c); }
                else {
                    if(stack.isEmpty()) {
                        stack.push(c);
                        break;
                    } else {
                        if((stack.peek()=='['&amp;amp;&amp;amp;c==']') || (stack.peek()=='('&amp;amp;&amp;amp;c==')') || (stack.peek()=='{'&amp;amp;&amp;amp;c=='}')) {
                            stack.pop();
                        }
                    }
                }
            }
            
            if(stack.isEmpty()) { answer++; }
            
            s = s.substring(1, len)+String.valueOf(s.charAt(0));
        }
        
        return answer;
    }
}&lt;/code&gt;&lt;/pre&gt;</description>
      <category>Problem Solving/Programmers</category>
      <author>kmkunk</author>
      <guid isPermaLink="true">https://kmkunk.tistory.com/289</guid>
      <comments>https://kmkunk.tistory.com/289#entry289comment</comments>
      <pubDate>Wed, 6 Apr 2022 11:24:19 +0900</pubDate>
    </item>
    <item>
      <title>[Level 2] 예상 대진표</title>
      <link>https://kmkunk.tistory.com/288</link>
      <description>&lt;pre id=&quot;code_1649211823504&quot; class=&quot;java&quot; data-ke-language=&quot;java&quot; data-ke-type=&quot;codeblock&quot;&gt;&lt;code&gt;class Solution {
    public int solution(int n, int a, int b) {
        int answer = 1;
        int x = Math.min(a,b);
        int y = Math.max(a,b);

        for(int i=1; i&amp;lt;=20; i++) {
            if(y%2==0 &amp;amp;&amp;amp; y-x==1) { break; }
            
            x = (x+1)/2;
            y = (y+1)/2;
            answer++;
        }
        
        return answer;
    }
}&lt;/code&gt;&lt;/pre&gt;</description>
      <category>Problem Solving/Programmers</category>
      <author>kmkunk</author>
      <guid isPermaLink="true">https://kmkunk.tistory.com/288</guid>
      <comments>https://kmkunk.tistory.com/288#entry288comment</comments>
      <pubDate>Wed, 6 Apr 2022 11:23:46 +0900</pubDate>
    </item>
    <item>
      <title>[Silver 2] 15663번 N과 M (9)</title>
      <link>https://kmkunk.tistory.com/287</link>
      <description>&lt;pre id=&quot;code_1648791819188&quot; class=&quot;java&quot; data-ke-language=&quot;java&quot; data-ke-type=&quot;codeblock&quot;&gt;&lt;code&gt;import java.util.*;
import java.io.*;

public class Main {
    public static int n; public static int m;
    public static int[] ans;
    public static int[] numbers;
    public static boolean[] tf;
    public static LinkedHashSet&amp;lt;String&amp;gt; set;
    
    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String[] arr1 = br.readLine().split(&quot; &quot;); String[] arr2 = br.readLine().split(&quot; &quot;);
        n = Integer.parseInt(arr1[0]); m = Integer.parseInt(arr1[1]);
        numbers = new int[n]; ans = new int[m]; tf = new boolean[n];
        set = new LinkedHashSet&amp;lt;&amp;gt;();
        StringBuilder sb2 = new StringBuilder();
        
        for(int i=0; i&amp;lt;n; i++) { numbers[i] = Integer.parseInt(arr2[i]); }
        Arrays.sort(numbers);
        
        calc(0);
        for(String s : set) { sb2.append(s).append(&quot;\n&quot;); }
        System.out.println(sb2);
    }
    
    public static void calc(int index) {
        if(index==m) {
            StringBuilder sb = new StringBuilder();
            for(int a : ans) {
                sb.append(String.valueOf(a)).append(&quot; &quot;);
            }
            
            set.add(sb.toString()); return;
        }
        
        for(int i=0; i&amp;lt;n; i++) {
            if(tf[i]) { continue; }
            
            tf[i] = true;
            ans[index] = numbers[i];
            calc(index+1);
            tf[i] = false;
        }
    }
}&lt;/code&gt;&lt;/pre&gt;</description>
      <category>Problem Solving/BOJ</category>
      <author>kmkunk</author>
      <guid isPermaLink="true">https://kmkunk.tistory.com/287</guid>
      <comments>https://kmkunk.tistory.com/287#entry287comment</comments>
      <pubDate>Fri, 1 Apr 2022 14:43:46 +0900</pubDate>
    </item>
    <item>
      <title>[Silver 3] 15657번 N과 M (8)</title>
      <link>https://kmkunk.tistory.com/286</link>
      <description>&lt;pre id=&quot;code_1648791698615&quot; class=&quot;java&quot; data-ke-language=&quot;java&quot; data-ke-type=&quot;codeblock&quot;&gt;&lt;code&gt;import java.util.*;
import java.io.*;

public class Main {
    public static int n; public static int m;
    public static int[] numbers;
    public static int[] ans;
    public static StringBuilder sb;
    
    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String[] arr1 = br.readLine().split(&quot; &quot;);
        String[] arr2 = br.readLine().split(&quot; &quot;);
        n = Integer.parseInt(arr1[0]); m = Integer.parseInt(arr1[1]);
        numbers = new int[n]; ans = new int[m];
        sb = new StringBuilder();
        
        for(int i=0; i&amp;lt;n; i++) { numbers[i] = Integer.parseInt(arr2[i]); }
        Arrays.sort(numbers);
        
        calc(0, 0);
        System.out.println(sb);
    }
    
    public static void calc(int index, int start) {
        if(index==m) {
            for(int a : ans) { sb.append(String.valueOf(a)).append(&quot; &quot;); }
            
            sb.append(&quot;\n&quot;); return;
        }
        
        for(int i=start; i&amp;lt;n; i++) {
            ans[index] = numbers[i];
            calc(index+1, i);
        }
    }
}&lt;/code&gt;&lt;/pre&gt;</description>
      <category>Problem Solving/BOJ</category>
      <author>kmkunk</author>
      <guid isPermaLink="true">https://kmkunk.tistory.com/286</guid>
      <comments>https://kmkunk.tistory.com/286#entry286comment</comments>
      <pubDate>Fri, 1 Apr 2022 14:41:40 +0900</pubDate>
    </item>
    <item>
      <title>[Silver 3] 15656번 N과 M (7)</title>
      <link>https://kmkunk.tistory.com/285</link>
      <description>&lt;pre id=&quot;code_1648791665432&quot; class=&quot;java&quot; data-ke-language=&quot;java&quot; data-ke-type=&quot;codeblock&quot;&gt;&lt;code&gt;import java.util.*;
import java.io.*;

public class Main {
    public static int n; public static int m;
    public static int[] numbers;
    public static int[] ans;
    public static StringBuilder sb;
    
    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String[] arr1 = br.readLine().split(&quot; &quot;);
        String[] arr2 = br.readLine().split(&quot; &quot;);
        n = Integer.parseInt(arr1[0]); m = Integer.parseInt(arr1[1]);
        numbers = new int[n]; ans = new int[m];
        sb = new StringBuilder();
        
        for(int i=0; i&amp;lt;n; i++) { numbers[i] = Integer.parseInt(arr2[i]); }
        
        Arrays.sort(numbers);
        
        calc(0);
        System.out.println(sb);
    }
    
    public static void calc(int index) {
        if(index==m) {
            for(int a : ans) { sb.append(String.valueOf(a)).append(&quot; &quot;); }
            
            sb.append(&quot;\n&quot;); return;
        }
        
        for(int i=0; i&amp;lt;n; i++) {
            ans[index] = numbers[i];
            calc(index+1);
        }
    }
}&lt;/code&gt;&lt;/pre&gt;</description>
      <category>Problem Solving/BOJ</category>
      <author>kmkunk</author>
      <guid isPermaLink="true">https://kmkunk.tistory.com/285</guid>
      <comments>https://kmkunk.tistory.com/285#entry285comment</comments>
      <pubDate>Fri, 1 Apr 2022 14:41:07 +0900</pubDate>
    </item>
    <item>
      <title>[Silver 3] 15655번 N과 M (6)</title>
      <link>https://kmkunk.tistory.com/284</link>
      <description>&lt;pre id=&quot;code_1648791634793&quot; class=&quot;java&quot; data-ke-language=&quot;java&quot; data-ke-type=&quot;codeblock&quot;&gt;&lt;code&gt;import java.util.*;
import java.io.*;

public class Main {
    public static int[] numbers;
    public static int[] ans;
    public static StringBuilder sb;
    
    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String[] arr1 = br.readLine().split(&quot; &quot;);
        String[] arr2 = br.readLine().split(&quot; &quot;);
        int n = Integer.parseInt(arr1[0]); int m = Integer.parseInt(arr1[1]);
        numbers = new int[n]; ans = new int[m];
        sb = new StringBuilder();
        
        for(int i=0; i&amp;lt;n; i++) { numbers[i] = Integer.parseInt(arr2[i]); }
        
        Arrays.sort(numbers);
        calc(0, 0, n, m);
        
        System.out.println(sb);
    }
    
    public static void calc(int index, int selected, int n, int m) {
        if(selected==m) {
            for(int a : ans) { sb.append(String.valueOf(a)).append(&quot; &quot;); }
            
            sb.append(&quot;\n&quot;); return;
        }
        
        if(index&amp;gt;=n) { return; }
        
        ans[selected] = numbers[index];
        calc(index+1, selected+1, n, m);
        calc(index+1, selected, n, m);
    }
}&lt;/code&gt;&lt;/pre&gt;</description>
      <category>Problem Solving/BOJ</category>
      <author>kmkunk</author>
      <guid isPermaLink="true">https://kmkunk.tistory.com/284</guid>
      <comments>https://kmkunk.tistory.com/284#entry284comment</comments>
      <pubDate>Fri, 1 Apr 2022 14:40:36 +0900</pubDate>
    </item>
    <item>
      <title>[Silver 3] 15654번 N과 M (5)</title>
      <link>https://kmkunk.tistory.com/283</link>
      <description>&lt;pre id=&quot;code_1648791607425&quot; class=&quot;java&quot; data-ke-language=&quot;java&quot; data-ke-type=&quot;codeblock&quot;&gt;&lt;code&gt;import java.io.*;
import java.util.*;

public class Main {
    public static int[] numbers;
    public static int[] ans;
    public static boolean[] tf;
    public static StringBuilder sb;
    
    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String[] arr1 = br.readLine().split(&quot; &quot;);
        String[] arr2 = br.readLine().split(&quot; &quot;);
        int n = Integer.parseInt(arr1[0]); int m = Integer.parseInt(arr1[1]);
        numbers = new int[n]; ans = new int[m]; tf = new boolean[n];
        sb = new StringBuilder();
        
        for(int i=0; i&amp;lt;n; i++) { numbers[i] = Integer.parseInt(arr2[i]); }
        Arrays.sort(numbers);
        
        calc(0, n, m);
        System.out.println(sb);        
    }
    
    public static void calc(int index, int n, int m) {
        if(index==m) {
            for(int a : ans) {
                sb.append(String.valueOf(a)).append(&quot; &quot;);
            }
            
            sb.append(&quot;\n&quot;);
            return;
        }
        
        for(int i=0; i&amp;lt;n; i++) {
            if(tf[i]) { continue; }
            
            tf[i] = true;
            ans[index] = numbers[i];
            calc(index+1, n, m);
            tf[i] = false;
        }
    }
}&lt;/code&gt;&lt;/pre&gt;</description>
      <category>Problem Solving/BOJ</category>
      <author>kmkunk</author>
      <guid isPermaLink="true">https://kmkunk.tistory.com/283</guid>
      <comments>https://kmkunk.tistory.com/283#entry283comment</comments>
      <pubDate>Fri, 1 Apr 2022 14:40:12 +0900</pubDate>
    </item>
    <item>
      <title>[Silver 3] 15652번 N과 M (4)</title>
      <link>https://kmkunk.tistory.com/282</link>
      <description>&lt;pre id=&quot;code_1648791558187&quot; class=&quot;java&quot; data-ke-language=&quot;java&quot; data-ke-type=&quot;codeblock&quot;&gt;&lt;code&gt;import java.io.*;

public class Main {
    public static int[] ans;
    public static StringBuilder sb;
    
    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String[] arr = br.readLine().split(&quot; &quot;);
        int n = Integer.parseInt(arr[0]); int m = Integer.parseInt(arr[1]);
        sb = new StringBuilder();
        ans = new int[m];
        
        calc(0, 0, n, m);
        System.out.println(sb);
    }
    
    public static void calc(int index, int start, int n, int m) {
        if(index==m) {
            for(int a : ans) {
                sb.append(String.valueOf(a)).append(&quot; &quot;);
            }
            
            sb.append(&quot;\n&quot;);
            return;
        }

        for(int i=start; i&amp;lt;n; i++) {
            ans[index] = i+1;
            calc(index+1, i, n, m);
        }
    }
}&lt;/code&gt;&lt;/pre&gt;</description>
      <category>Problem Solving/BOJ</category>
      <author>kmkunk</author>
      <guid isPermaLink="true">https://kmkunk.tistory.com/282</guid>
      <comments>https://kmkunk.tistory.com/282#entry282comment</comments>
      <pubDate>Fri, 1 Apr 2022 14:39:20 +0900</pubDate>
    </item>
    <item>
      <title>[Silver 3] 15651번 N과 M (3)</title>
      <link>https://kmkunk.tistory.com/281</link>
      <description>&lt;pre id=&quot;code_1648791516421&quot; class=&quot;java&quot; data-ke-language=&quot;java&quot; data-ke-type=&quot;codeblock&quot;&gt;&lt;code&gt;import java.io.*;

public class Main {
    public static int[] ans;
    public static StringBuilder sb;
    
    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        sb = new StringBuilder();
        String[] arr = br.readLine().split(&quot; &quot;);
        int n = Integer.parseInt(arr[0]); int m = Integer.parseInt(arr[1]);
        ans = new int[m];
        
        calc(0, n, m);
        System.out.println(sb);
    }
    
    public static void calc(int index, int n, int m) {
        if(index==m) {
            for(int a : ans) {
                sb.append(String.valueOf(a)).append(&quot; &quot;);
            }
            
            sb.append(&quot;\n&quot;);
            return;
        }
        
        for(int i=0; i&amp;lt;n; i++) {
            ans[index] = i+1;
            calc(index+1, n, m);
        }
    }
}&lt;/code&gt;&lt;/pre&gt;</description>
      <category>Problem Solving/BOJ</category>
      <author>kmkunk</author>
      <guid isPermaLink="true">https://kmkunk.tistory.com/281</guid>
      <comments>https://kmkunk.tistory.com/281#entry281comment</comments>
      <pubDate>Fri, 1 Apr 2022 14:38:37 +0900</pubDate>
    </item>
    <item>
      <title>[Silver 3] 15650번 N과 M (2)</title>
      <link>https://kmkunk.tistory.com/280</link>
      <description>&lt;pre id=&quot;code_1648791482084&quot; class=&quot;java&quot; data-ke-language=&quot;java&quot; data-ke-type=&quot;codeblock&quot;&gt;&lt;code&gt;import java.io.*;

public class Main {
    public static int[] ans;
    public static StringBuilder sb;
    
    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        sb = new StringBuilder();
        String[] arr = br.readLine().split(&quot; &quot;);
        int n = Integer.parseInt(arr[0]); int m = Integer.parseInt(arr[1]);
        ans = new int[m];
        
        calc(1, 0, n, m);
        
        System.out.println(sb);
    }
    
    public static void calc(int index, int selected, int n, int m) {
        if(selected==m) {
            for(int a : ans) {
                sb.append(a).append(&quot; &quot;);
            }
            
            sb.append(&quot;\n&quot;);
            return;
        }
        
        if(index&amp;gt;n) { return; }
        
        ans[selected] = index;
        calc(index+1, selected+1, n, m);
        calc(index+1, selected, n, m);
    }
}&lt;/code&gt;&lt;/pre&gt;</description>
      <category>Problem Solving/BOJ</category>
      <author>kmkunk</author>
      <guid isPermaLink="true">https://kmkunk.tistory.com/280</guid>
      <comments>https://kmkunk.tistory.com/280#entry280comment</comments>
      <pubDate>Fri, 1 Apr 2022 14:38:04 +0900</pubDate>
    </item>
    <item>
      <title>[Silver 3] 15649번 N과 M (1)</title>
      <link>https://kmkunk.tistory.com/279</link>
      <description>&lt;pre id=&quot;code_1648791432795&quot; class=&quot;java&quot; data-ke-language=&quot;java&quot; data-ke-type=&quot;codeblock&quot;&gt;&lt;code&gt;import java.io.*;

public class Main {
    public static boolean[] tf;
    public static int[] ans;
    public static StringBuilder sb;
    
    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        sb = new StringBuilder();
        String[] arr = br.readLine().split(&quot; &quot;);
        int n = Integer.parseInt(arr[0]); int m = Integer.parseInt(arr[1]);
        tf = new boolean[n];
        ans = new int[m];
        
        calc(0, n, m);
        System.out.println(sb);
    }
    
    public static void calc(int index, int n, int m) {
        if(index==m) {
            for(int a : ans) { sb.append(String.valueOf(a)).append(&quot; &quot;); }
            sb.append(&quot;\n&quot;);
            return;
        }
        
        for(int i=0; i&amp;lt;n; i++) {
            if(tf[i]) { continue; }
            
            tf[i] = true;
            ans[index] = i+1;
            calc(index+1, n, m);
            tf[i] = false;
        }
    }
}&lt;/code&gt;&lt;/pre&gt;</description>
      <category>Problem Solving/BOJ</category>
      <author>kmkunk</author>
      <guid isPermaLink="true">https://kmkunk.tistory.com/279</guid>
      <comments>https://kmkunk.tistory.com/279#entry279comment</comments>
      <pubDate>Fri, 1 Apr 2022 14:37:15 +0900</pubDate>
    </item>
    <item>
      <title>[Silver 3] 1748번 수 이어 쓰기 1</title>
      <link>https://kmkunk.tistory.com/278</link>
      <description>&lt;pre id=&quot;code_1648790831906&quot; class=&quot;java&quot; data-ke-language=&quot;java&quot; data-ke-type=&quot;codeblock&quot;&gt;&lt;code&gt;import java.io.*;

public class Main {
    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        int n = Integer.parseInt(br.readLine());
        int len = String.valueOf(n).length();
        String s = &quot;&quot;;
        int ans = 0;

        for(int i=1; i&amp;lt;len; i++) {
            s += &quot;9&quot;;
            ans += 9*Math.pow(10, i-1)*i;
        }
        
        int nine = len==1 ? 0 : Integer.parseInt(s);
        ans += (n-nine)*len;
        
        System.out.println(ans);
    }
}&lt;/code&gt;&lt;/pre&gt;</description>
      <category>Problem Solving/BOJ</category>
      <author>kmkunk</author>
      <guid isPermaLink="true">https://kmkunk.tistory.com/278</guid>
      <comments>https://kmkunk.tistory.com/278#entry278comment</comments>
      <pubDate>Fri, 1 Apr 2022 14:27:13 +0900</pubDate>
    </item>
    <item>
      <title>[Silver 1] 6064번 카잉 달력</title>
      <link>https://kmkunk.tistory.com/277</link>
      <description>&lt;pre id=&quot;code_1648790780620&quot; class=&quot;java&quot; data-ke-language=&quot;java&quot; data-ke-type=&quot;codeblock&quot;&gt;&lt;code&gt;import java.io.*;

public class Main {
    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        int t = Integer.parseInt(br.readLine());
        
        while(t-- &amp;gt; 0) {
            String[] arr = br.readLine().split(&quot; &quot;);
            int m = Integer.parseInt(arr[0]); int n = Integer.parseInt(arr[1]);
            int x = Integer.parseInt(arr[2]); int y = Integer.parseInt(arr[3]);
            int temp = 0;
            boolean noAnswer = true;
            
            for(int i=x; i&amp;lt;=m*n; i+=m) {
                temp = (i-1)%n+1;
                if(temp==y) {
                    System.out.println(i);
                    noAnswer = false;
                    break;
                }
            }
            
            if(noAnswer) { System.out.println(-1); }
        }
    }
}&lt;/code&gt;&lt;/pre&gt;</description>
      <category>Problem Solving/BOJ</category>
      <author>kmkunk</author>
      <guid isPermaLink="true">https://kmkunk.tistory.com/277</guid>
      <comments>https://kmkunk.tistory.com/277#entry277comment</comments>
      <pubDate>Fri, 1 Apr 2022 14:26:26 +0900</pubDate>
    </item>
    <item>
      <title>[Gold 5] 14500번 테트로미노</title>
      <link>https://kmkunk.tistory.com/276</link>
      <description>&lt;pre id=&quot;code_1648790732614&quot; class=&quot;java&quot; data-ke-language=&quot;java&quot; data-ke-type=&quot;codeblock&quot;&gt;&lt;code&gt;import java.io.*;

public class Main {
    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String[] arr = br.readLine().split(&quot; &quot;);
        int n = Integer.parseInt(arr[0]);
        int m = Integer.parseInt(arr[1]);
        int[][] paper = new int[n+1][m+1];
        int temp = 0;
        int ans = 0;
        
        for(int i=1; i&amp;lt;=n; i++) {
            String[] s = br.readLine().split(&quot; &quot;);
            for(int j=1; j&amp;lt;=m; j++) { paper[i][j] = Integer.parseInt(s[j-1]); }
        }
        
        //blue: 1*4
        for(int i=1; i&amp;lt;=n; i++) {
            for(int j=1; j&amp;lt;=m-3; j++) {
                temp = paper[i][j]+paper[i][j+1]+paper[i][j+2]+paper[i][j+3];
                ans = Math.max(ans, temp);
            }
        }
        
        //blue: 4*1
        for(int i=1; i&amp;lt;=n-3; i++) {
            for(int j=1; j&amp;lt;=m; j++) {
                temp = paper[i][j]+paper[i+1][j]+paper[i+2][j]+paper[i+3][j];
                ans = Math.max(ans, temp);
            }
        }
        
        //yellow
        for(int i=1; i&amp;lt;=n-1; i++) {
            for(int j=1; j&amp;lt;=m-1; j++) {
                temp = paper[i][j]+paper[i+1][j]+paper[i][j+1]+paper[i+1][j+1];
                ans = Math.max(ans, temp);
            }
        }
        
        //pink: 위&amp;amp;아래
        for(int i=1; i&amp;lt;=n-1; i++) {
            for(int j=1; j&amp;lt;=m-2; j++) {
                temp = paper[i][j+1]+paper[i+1][j]+paper[i+1][j+1]+paper[i+1][j+2];
                ans = Math.max(ans, temp);
                
                temp = paper[i][j]+paper[i][j+1]+paper[i][j+2]+paper[i+1][j+1];
                ans = Math.max(ans, temp);
            }
        }
        
        //pink: 오른쪽&amp;amp;왼쪽
        for(int i=1; i&amp;lt;=n-2; i++) {
            for(int j=1; j&amp;lt;=m-1; j++) {
                temp = paper[i][j]+paper[i+1][j]+paper[i+1][j+1]+paper[i+2][j];
                ans = Math.max(ans, temp);
                
                temp = paper[i][j+1]+paper[i+1][j]+paper[i+1][j+1]+paper[i+2][j+1];
                ans = Math.max(ans, temp);
            }
        }
        
        //green : 1&amp;amp;2
        for(int i=1; i&amp;lt;=n-2; i++) {
            for(int j=1; j&amp;lt;=m-1; j++) {
                temp = paper[i][j]+paper[i+1][j]+paper[i+1][j+1]+paper[i+2][j+1];
                ans = Math.max(ans, temp);
                
                temp = paper[i][j+1]+paper[i+1][j]+paper[i+1][j+1]+paper[i+2][j];
                ans = Math.max(ans, temp);
            }
        }
        
        //green : 3&amp;amp;4
        for(int i=1; i&amp;lt;=n-1; i++) {
            for(int j=1; j&amp;lt;=m-2; j++) {
                temp = paper[i+1][j]+paper[i+1][j+1]+paper[i][j+1]+paper[i][j+2];
                ans = Math.max(ans, temp);
                
                temp = paper[i][j]+paper[i][j+1]+paper[i+1][j+1]+paper[i+1][j+2];
                ans = Math.max(ans, temp);
            }
        }
        
        //orange: 1&amp;amp;2&amp;amp;3&amp;amp;4
        for(int i=1; i&amp;lt;=n-2; i++) {
            for(int j=1; j&amp;lt;=m-1; j++) {
                temp = paper[i][j]+paper[i+1][j]+paper[i+2][j]+paper[i+2][j+1];
                ans = Math.max(ans, temp);
                
                temp = paper[i][j]+paper[i+1][j]+paper[i+2][j]+paper[i][j+1];
                ans = Math.max(ans, temp);
                
                temp = paper[i][j+1]+paper[i+1][j+1]+paper[i+2][j+1]+paper[i+2][j];
                ans = Math.max(ans, temp);
                
                temp = paper[i][j]+paper[i][j+1]+paper[i+1][j+1]+paper[i+2][j+1];
                ans = Math.max(ans, temp);
            }
        }
        
        //orange: 5&amp;amp;6&amp;amp;7&amp;amp;8
        for(int i=1; i&amp;lt;=n-1; i++) {
            for(int j=1; j&amp;lt;=m-2; j++) {
                temp = paper[i][j]+paper[i+1][j]+paper[i][j+1]+paper[i][j+2];
                ans = Math.max(ans, temp);
                
                temp = paper[i][j]+paper[i][j+1]+paper[i][j+2]+paper[i+1][j+2];
                ans = Math.max(ans, temp);
                
                temp = paper[i][j]+paper[i+1][j]+paper[i+1][j+1]+paper[i+1][j+2];
                ans = Math.max(ans, temp);
                
                temp = paper[i+1][j]+paper[i+1][j+1]+paper[i+1][j+2]+paper[i][j+2];
                ans = Math.max(ans, temp);
            }
        }
        
        System.out.println(ans);
    }
}&lt;/code&gt;&lt;/pre&gt;</description>
      <category>Problem Solving/BOJ</category>
      <author>kmkunk</author>
      <guid isPermaLink="true">https://kmkunk.tistory.com/276</guid>
      <comments>https://kmkunk.tistory.com/276#entry276comment</comments>
      <pubDate>Fri, 1 Apr 2022 14:25:38 +0900</pubDate>
    </item>
    <item>
      <title>[Gold 5] 1107번 리모컨</title>
      <link>https://kmkunk.tistory.com/275</link>
      <description>&lt;pre id=&quot;code_1648790699105&quot; class=&quot;java&quot; data-ke-language=&quot;java&quot; data-ke-type=&quot;codeblock&quot;&gt;&lt;code&gt;import java.io.*;

public class Main {
    public static boolean[] broken = new boolean[10];
    
    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        int n = Integer.parseInt(br.readLine());
        int m = Integer.parseInt(br.readLine());
        int ans = Math.abs(100-n);
        if(m==0) {
            ans = Math.min(ans, String.valueOf(n).length());
            System.out.println(ans); return;
        }
        
        String[] arr = br.readLine().split(&quot; &quot;);
        for(int i=0; i&amp;lt;m; i++) { broken[Integer.parseInt(arr[i])] = true; }
        for(int i=0; i&amp;lt;=1_000_000; i++) {
            if(check(i)==0) { continue; }
            ans = Math.min(ans, Math.abs(i-n)+check(i));
        }
        
        System.out.println(ans);
    }
    
    public static int check(int i) {
        int check = 0;
        if(i==0) {
            if(broken[i]) { return 0; }
            else { return 1; }
        }
        
        while(i&amp;gt;0) {
            int temp = i%10;
            if(broken[temp]) { return 0; }
            
            check++;
            i /= 10;
        }
        
        return check;
    }
}&lt;/code&gt;&lt;/pre&gt;</description>
      <category>Problem Solving/BOJ</category>
      <author>kmkunk</author>
      <guid isPermaLink="true">https://kmkunk.tistory.com/275</guid>
      <comments>https://kmkunk.tistory.com/275#entry275comment</comments>
      <pubDate>Fri, 1 Apr 2022 14:25:01 +0900</pubDate>
    </item>
    <item>
      <title>[Silver 5] 1476번 날짜 계산</title>
      <link>https://kmkunk.tistory.com/274</link>
      <description>&lt;pre id=&quot;code_1648790587943&quot; class=&quot;java&quot; data-ke-language=&quot;java&quot; data-ke-type=&quot;codeblock&quot;&gt;&lt;code&gt;import java.io.*;

public class Main {
    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String[] arr = br.readLine().split(&quot; &quot;);
        int[] esm = new int[4];
        int e = 1; int s = 1; int m = 1;
        
        for(int i=1; i&amp;lt;=3; i++) { esm[i] = Integer.parseInt(arr[i-1]); }
        
        for(int i=1; i&amp;lt;=7980; i++) {
            if(e==esm[1] &amp;amp;&amp;amp; s==esm[2] &amp;amp;&amp;amp; m==esm[3]) {
                System.out.println(i);
                return;
            }
            
            e++; s++; m++;
            
            e = (e-1)%15+1;
            s = (s-1)%28+1;
            m = (m-1)%19+1;
        }
    }
}&lt;/code&gt;&lt;/pre&gt;</description>
      <category>Problem Solving/BOJ</category>
      <author>kmkunk</author>
      <guid isPermaLink="true">https://kmkunk.tistory.com/274</guid>
      <comments>https://kmkunk.tistory.com/274#entry274comment</comments>
      <pubDate>Fri, 1 Apr 2022 14:23:11 +0900</pubDate>
    </item>
    <item>
      <title>[Silver 3] 3085번 사탕 게임</title>
      <link>https://kmkunk.tistory.com/273</link>
      <description>&lt;pre id=&quot;code_1648790382576&quot; class=&quot;java&quot; data-ke-language=&quot;java&quot; data-ke-type=&quot;codeblock&quot;&gt;&lt;code&gt;import java.io.*;

public class Main {
    public static String[][] board;
    public static int n;
    public static int max;
        
    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        n = Integer.parseInt(br.readLine());
        board = new String[n+1][n+1];
        max = 1;
        
        for(int i=1; i&amp;lt;=n; i++) {
            String[] arr = br.readLine().split(&quot;&quot;);
            for(int j=1; j&amp;lt;=n; j++) { board[i][j] = arr[j-1]; }
        }
        
        for(int i=1; i&amp;lt;=n; i++) {
            for(int j=1; j&amp;lt;=n; j++) {
                if((i==n&amp;amp;&amp;amp;j==n) || max==n) { System.out.println(max); return; }
                
                countC(i, j);
                countR(i, j);
                
                if(i==n) {
                    swapC(i ,j);
                    countC(i, j);
                    countR(i, j);
                    countR(i, j+1);
                    swapC(i ,j);
                    continue;
                } else if(j==n) {
                    swapR(i ,j);
                    countR(i, j);
                    countC(i, j);
                    countC(i+1, j);
                    swapR(i ,j);
                    continue;
                }
                
                swapC(i ,j);
                countC(i, j);
                countR(i, j);
                countR(i, j+1);
                swapC(i ,j);
                
                swapR(i ,j);
                countR(i, j);
                countC(i, j);
                countC(i+1, j);
                swapR(i ,j);
            }
        }
        
        System.out.println(max);
    }
    
    public static void countC(int i, int j) {
        int count = 1;
        for(int k=2; k&amp;lt;=n; k++) {
            if(board[i][k].equals(board[i][k-1])) {
                count++;
                max = Math.max(max, count);
            } else { count = 1; }
        }        
    }
    
    public static void countR(int i, int j) {
        int count = 1;
        for(int k=2; k&amp;lt;=n; k++) {
            if(board[k][j].equals(board[k-1][j])) {
                count++;
                max = Math.max(max, count);
            } else { count = 1; }
        }        
    }
    
    public static void swapC(int i, int j) {
        String temp = board[i][j];
        board[i][j] = board[i][j+1];
        board[i][j+1] = temp;
    }
    
    public static void swapR(int i, int j) {
        String temp = board[i][j];
        board[i][j] = board[i+1][j];
        board[i+1][j] = temp;
    }
}&lt;/code&gt;&lt;/pre&gt;</description>
      <category>Problem Solving/BOJ</category>
      <author>kmkunk</author>
      <guid isPermaLink="true">https://kmkunk.tistory.com/273</guid>
      <comments>https://kmkunk.tistory.com/273#entry273comment</comments>
      <pubDate>Fri, 1 Apr 2022 14:21:16 +0900</pubDate>
    </item>
    <item>
      <title>[Level 2] 조이스틱</title>
      <link>https://kmkunk.tistory.com/272</link>
      <description>&lt;pre id=&quot;code_1648712248968&quot; class=&quot;java&quot; data-ke-language=&quot;java&quot; data-ke-type=&quot;codeblock&quot;&gt;&lt;code&gt;class Solution {
    public int solution(String name) {
        int answer = 0;
        int count = name.length()-1;
        
        for(int i=0; i&amp;lt;name.length(); i++) {
            char c = name.charAt(i);
            int index = i+1;
            
            answer += c&amp;lt;'N' ? (c-'0')-('A'-'0') : 26-(c-'0')+('A'-'0');
            
            while(index&amp;lt;name.length() &amp;amp;&amp;amp; name.charAt(index)=='A') { index++; }
            
            count = Math.min(count, name.length()-index+i*2);
            count = Math.min(count, (name.length()-index)*2+i);
        }
        
        return answer+count;
    }
}&lt;/code&gt;&lt;/pre&gt;</description>
      <category>Problem Solving/Programmers</category>
      <author>kmkunk</author>
      <guid isPermaLink="true">https://kmkunk.tistory.com/272</guid>
      <comments>https://kmkunk.tistory.com/272#entry272comment</comments>
      <pubDate>Thu, 31 Mar 2022 16:37:39 +0900</pubDate>
    </item>
    <item>
      <title>[Level 2] 소수 찾기</title>
      <link>https://kmkunk.tistory.com/271</link>
      <description>&lt;pre id=&quot;code_1648712184102&quot; class=&quot;java&quot; data-ke-language=&quot;java&quot; data-ke-type=&quot;codeblock&quot;&gt;&lt;code&gt;import java.util.*;

class Solution {
    public boolean[] visited;    
    public String[] arr;
    public int answer = 0;
    public Set&amp;lt;Integer&amp;gt; set = new HashSet&amp;lt;&amp;gt;();
    
    public int solution(String numbers) {
        arr = numbers.split(&quot;&quot;);
        visited = new boolean[arr.length];
        
        for(int i=1; i&amp;lt;=arr.length; i++) { recur(0, i, &quot;&quot;); }
        
        return answer;
    }
    
    public void recur(int index, int len, String s) {
        if(index==len) {
            int n = Integer.parseInt(s);
            if(isPrime(n) &amp;amp;&amp;amp; !set.contains(n)) {
                set.add(n);
                answer++;
            }
            
            return;
        }
        
        for(int i=0; i&amp;lt;arr.length; i++) {
            if(visited[i]) { continue; }
            
            visited[i] = true;
            recur(index+1, len, s+arr[i]);
            visited[i] = false;
        }
    }
    
    public boolean isPrime(int n) {
        if(n==0 || n==1) { return false; }
        
        for(int i=2; i*i&amp;lt;=n; i++) {
            if(n%i==0) { return false; }
        }
        
        return true;
    }
}&lt;/code&gt;&lt;/pre&gt;</description>
      <category>Problem Solving/Programmers</category>
      <author>kmkunk</author>
      <guid isPermaLink="true">https://kmkunk.tistory.com/271</guid>
      <comments>https://kmkunk.tistory.com/271#entry271comment</comments>
      <pubDate>Thu, 31 Mar 2022 16:36:35 +0900</pubDate>
    </item>
    <item>
      <title>[Level 2] 가장 큰 수</title>
      <link>https://kmkunk.tistory.com/270</link>
      <description>&lt;pre id=&quot;code_1648712145870&quot; class=&quot;java&quot; data-ke-language=&quot;java&quot; data-ke-type=&quot;codeblock&quot;&gt;&lt;code&gt;import java.util.*;

class Solution {
    public String solution(int[] numbers) {
        String answer = &quot;&quot;;
        String[] arr = new String[numbers.length];
        
        for(int i=0; i&amp;lt;arr.length; i++) { arr[i] = String.valueOf(numbers[i]); }
        
        Arrays.sort(arr, new Comparator&amp;lt;String&amp;gt;() {
            @Override
            public int compare(String s1, String s2) {
                return (s2+s1).compareTo(s1+s2);
            }
        });
        
        for(String s : arr) { answer += s; }
        
        return answer;
    }
}&lt;/code&gt;&lt;/pre&gt;</description>
      <category>Problem Solving/Programmers</category>
      <author>kmkunk</author>
      <guid isPermaLink="true">https://kmkunk.tistory.com/270</guid>
      <comments>https://kmkunk.tistory.com/270#entry270comment</comments>
      <pubDate>Thu, 31 Mar 2022 16:36:09 +0900</pubDate>
    </item>
    <item>
      <title>[Level 2] 프린터</title>
      <link>https://kmkunk.tistory.com/269</link>
      <description>&lt;pre id=&quot;code_1648712111525&quot; class=&quot;java&quot; data-ke-language=&quot;java&quot; data-ke-type=&quot;codeblock&quot;&gt;&lt;code&gt;import java.util.*;

class Solution {
    public int solution(int[] priorities, int location) {
        int answer = 1;
        PriorityQueue&amp;lt;Integer&amp;gt; pq = new PriorityQueue&amp;lt;&amp;gt;(Collections.reverseOrder());
        
        for(int p : priorities) { pq.add(p); }
        
        while(!pq.isEmpty()) {
            for(int i=0; i&amp;lt;priorities.length; i++) {
                if(pq.peek()==priorities[i]) {
                    if(i==location) { return answer; }
                    
                    pq.poll();
                    answer++;
                }
            }
        }
        
        return answer;
    }
}&lt;/code&gt;&lt;/pre&gt;</description>
      <category>Problem Solving/Programmers</category>
      <author>kmkunk</author>
      <guid isPermaLink="true">https://kmkunk.tistory.com/269</guid>
      <comments>https://kmkunk.tistory.com/269#entry269comment</comments>
      <pubDate>Thu, 31 Mar 2022 16:35:35 +0900</pubDate>
    </item>
    <item>
      <title>[Level 2] 전화번호 목록</title>
      <link>https://kmkunk.tistory.com/268</link>
      <description>&lt;pre id=&quot;code_1648712090579&quot; class=&quot;java&quot; data-ke-language=&quot;java&quot; data-ke-type=&quot;codeblock&quot;&gt;&lt;code&gt;import java.util.*;

class Solution {
    public boolean solution(String[] phone_book) {
        Arrays.sort(phone_book);
        
        for(int i=0; i&amp;lt;phone_book.length-1; i++) {
            if(phone_book[i+1].startsWith(phone_book[i])) { return false; }
        }
        
        return true;
    }
}&lt;/code&gt;&lt;/pre&gt;</description>
      <category>Problem Solving/Programmers</category>
      <author>kmkunk</author>
      <guid isPermaLink="true">https://kmkunk.tistory.com/268</guid>
      <comments>https://kmkunk.tistory.com/268#entry268comment</comments>
      <pubDate>Thu, 31 Mar 2022 16:35:02 +0900</pubDate>
    </item>
    <item>
      <title>[Level 2] 튜플</title>
      <link>https://kmkunk.tistory.com/267</link>
      <description>&lt;pre id=&quot;code_1648712058387&quot; class=&quot;java&quot; data-ke-language=&quot;java&quot; data-ke-type=&quot;codeblock&quot;&gt;&lt;code&gt;import java.util.*;

class Solution {
    public int[] solution(String s) {
        List&amp;lt;String&amp;gt; list = new ArrayList&amp;lt;&amp;gt;();
        
        if(!s.contains(&quot;},{&quot;)) {
            return new int[]{Integer.parseInt(s.replace(&quot;{{&quot;,&quot;&quot;).replace(&quot;}}&quot;,&quot;&quot;))};
        }
        
        String[] arr = s.split(&quot;\\}\\,\\{&quot;);
        for(int i=0; i&amp;lt;arr.length; i++) {
            arr[i] = arr[i].replace(&quot;{{&quot;,&quot;&quot;).replace(&quot;}}&quot;,&quot;&quot;);
        }
        
        Arrays.sort(arr, new Comparator&amp;lt;String&amp;gt;(){
            @Override
            public int compare(String s1, String s2) {
                return s1.length()-s2.length();
            }
        });
        
        int[] answer = new int[arr.length];
        list.add(arr[0]); answer[0] = Integer.parseInt(arr[0]);
        
        for(int i=1; i&amp;lt;answer.length; i++) {
            String[] ss = arr[i].split(&quot;,&quot;);
            for(String sss : ss) {
                if(list.contains(sss)) { continue; }
                
                list.add(sss); answer[i] = Integer.parseInt(sss);
                break;
            }
        }
        
        return answer;
    }
}&lt;/code&gt;&lt;/pre&gt;</description>
      <category>Problem Solving/Programmers</category>
      <author>kmkunk</author>
      <guid isPermaLink="true">https://kmkunk.tistory.com/267</guid>
      <comments>https://kmkunk.tistory.com/267#entry267comment</comments>
      <pubDate>Thu, 31 Mar 2022 16:34:34 +0900</pubDate>
    </item>
    <item>
      <title>[Level 2] [1차] 뉴스 클러스터링</title>
      <link>https://kmkunk.tistory.com/266</link>
      <description>&lt;pre id=&quot;code_1648711979778&quot; class=&quot;java&quot; data-ke-language=&quot;java&quot; data-ke-type=&quot;codeblock&quot;&gt;&lt;code&gt;import java.util.*;

class Solution {
    public int solution(String str1, String str2) {
        int count = 0;
        PriorityQueue&amp;lt;String&amp;gt; pq1 = new PriorityQueue&amp;lt;&amp;gt;();
        PriorityQueue&amp;lt;String&amp;gt; pq2 = new PriorityQueue&amp;lt;&amp;gt;();
        
        str1 = str1.toUpperCase(); str2 = str2.toUpperCase();
        
        for(int i=0; i&amp;lt;str1.length()-1; i++) {
            char c1 = str1.charAt(i); char c2 = str1.charAt(i+1);
            if(!(c1&amp;gt;='A'&amp;amp;&amp;amp;c1&amp;lt;='Z'&amp;amp;&amp;amp;c2&amp;gt;='A'&amp;amp;&amp;amp;c2&amp;lt;='Z')) { continue; }
            
            pq1.add(String.valueOf(c1)+String.valueOf(c2));
        }
        
        for(int i=0; i&amp;lt;str2.length()-1; i++) {
            char c1 = str2.charAt(i); char c2 = str2.charAt(i+1);
            if(!(c1&amp;gt;='A'&amp;amp;&amp;amp;c1&amp;lt;='Z'&amp;amp;&amp;amp;c2&amp;gt;='A'&amp;amp;&amp;amp;c2&amp;lt;='Z')) { continue; }
            
            pq2.add(String.valueOf(c1)+String.valueOf(c2));
        }
        
        String[] s1 = new String[pq1.size()];
        String[] s2 = new String[pq2.size()];
        
        if(s1.length==0 &amp;amp;&amp;amp; s2.length==0) { return 65536; }
        
        for(int i=0; i&amp;lt;s1.length; i++) { s1[i] = pq1.poll(); }
        for(int i=0; i&amp;lt;s2.length; i++) { s2[i] = pq2.poll(); }
        
        for(int i=0; i&amp;lt;s1.length; i++) {
            for(int j=0; j&amp;lt;s2.length; j++) {
                if(s1[i].equals(s2[j])) {
                    count++;
                    s2[j] = &quot;0&quot;;
                    break;
                }
            }
        }
        
        double rate = (double)count/(s1.length+s2.length-count);
        
        return (int)(rate*65536);
    }
}&lt;/code&gt;&lt;/pre&gt;</description>
      <category>Problem Solving/Programmers</category>
      <author>kmkunk</author>
      <guid isPermaLink="true">https://kmkunk.tistory.com/266</guid>
      <comments>https://kmkunk.tistory.com/266#entry266comment</comments>
      <pubDate>Thu, 31 Mar 2022 16:34:00 +0900</pubDate>
    </item>
    <item>
      <title>[Level 2] 짝지어 제거하기</title>
      <link>https://kmkunk.tistory.com/265</link>
      <description>&lt;pre id=&quot;code_1648711963747&quot; class=&quot;java&quot; data-ke-language=&quot;java&quot; data-ke-type=&quot;codeblock&quot;&gt;&lt;code&gt;import java.util.*;

class Solution {
    public int solution(String s) {
        Stack&amp;lt;Character&amp;gt; stack = new Stack&amp;lt;&amp;gt;();
        
        for(int i=0; i&amp;lt;s.length(); i++) {
            if(!stack.isEmpty() &amp;amp;&amp;amp; stack.peek()==s.charAt(i)) {
                stack.pop();
                continue;
            }
            
            stack.push(s.charAt(i));
        }
        
        return stack.isEmpty() ? 1 : 0;
    }
}&lt;/code&gt;&lt;/pre&gt;</description>
      <category>Problem Solving/Programmers</category>
      <author>kmkunk</author>
      <guid isPermaLink="true">https://kmkunk.tistory.com/265</guid>
      <comments>https://kmkunk.tistory.com/265#entry265comment</comments>
      <pubDate>Thu, 31 Mar 2022 16:32:47 +0900</pubDate>
    </item>
    <item>
      <title>[Level 2] 행렬 테두리 회전하기</title>
      <link>https://kmkunk.tistory.com/264</link>
      <description>&lt;pre id=&quot;code_1648711867858&quot; class=&quot;java&quot; data-ke-language=&quot;java&quot; data-ke-type=&quot;codeblock&quot;&gt;&lt;code&gt;import java.util.*;

class Solution {
    public int[] solution(int rows, int columns, int[][] queries) {
        int[] answer = new int[queries.length];
        int[][] arr = new int[rows][columns];
        int value = 1;
        
        for(int i=0; i&amp;lt;rows; i++) {
            for(int j=0; j&amp;lt;columns; j++) { arr[i][j] = value++; }
        }
        
        for(int i=0; i&amp;lt;queries.length; i++) {
            int x1 = queries[i][0]-1; int y1 = queries[i][1]-1;
            int x2 = queries[i][2]-1; int y2 = queries[i][3]-1;

            answer[i] = min(arr, x1, y1, x2, y2);
            
            int x1y2 = arr[x1][y2];
            int x2y1 = arr[x2][y1];
            int x2y2 = arr[x2][y2];
            
            for(int j=y2; j&amp;gt;y1; j--) { arr[x1][j] = arr[x1][j-1]; }
            for(int j=x2; j&amp;gt;x1+1; j--) { arr[j][y2] = arr[j-1][y2]; }
            for(int j=y1; j&amp;lt;y2-1; j++) { arr[x2][j] = arr[x2][j+1]; }
            for(int j=x1; j&amp;lt;x2-1; j++) { arr[j][y1] = arr[j+1][y1]; }
            
            arr[x1+1][y2] = x1y2;
            arr[x2-1][y1] = x2y1;
            arr[x2][y2-1] = x2y2;
        }
        
        return answer;
    }
    
    public int min(int[][] arr, int x1, int y1, int x2, int y2) {
        int min = Integer.MAX_VALUE;
        
        for(int i=x1; i&amp;lt;=x2; i++) {
            min = Math.min(min, arr[i][y1]);
            min = Math.min(min, arr[i][y2]);
        }
        
        for(int i=y1; i&amp;lt;=y2; i++) {
            min = Math.min(min, arr[x1][i]);
            min = Math.min(min, arr[x2][i]);
        }
        
        return min;
    }
}&lt;/code&gt;&lt;/pre&gt;</description>
      <category>Problem Solving/Programmers</category>
      <author>kmkunk</author>
      <guid isPermaLink="true">https://kmkunk.tistory.com/264</guid>
      <comments>https://kmkunk.tistory.com/264#entry264comment</comments>
      <pubDate>Thu, 31 Mar 2022 16:31:31 +0900</pubDate>
    </item>
    <item>
      <title>[Level 2] 타겟 넘버</title>
      <link>https://kmkunk.tistory.com/263</link>
      <description>&lt;pre id=&quot;code_1648711826935&quot; class=&quot;java&quot; data-ke-language=&quot;java&quot; data-ke-type=&quot;codeblock&quot;&gt;&lt;code&gt;class Solution {
    public int answer = 0;
    
    public int solution(int[] numbers, int target) {
        recur(0, numbers, 0, target);
        
        return answer;
    }
    
    public void recur(int index, int[] numbers, int sum, int target) {
        if(index==numbers.length) {
            if(sum==target) { answer++; }
            
            return;
        }
        
        recur(index+1, numbers, sum+numbers[index], target);
        recur(index+1, numbers, sum-numbers[index], target);
    }
}&lt;/code&gt;&lt;/pre&gt;</description>
      <category>Problem Solving/Programmers</category>
      <author>kmkunk</author>
      <guid isPermaLink="true">https://kmkunk.tistory.com/263</guid>
      <comments>https://kmkunk.tistory.com/263#entry263comment</comments>
      <pubDate>Thu, 31 Mar 2022 16:30:29 +0900</pubDate>
    </item>
  </channel>
</rss>