<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
    <channel>
        <title>woo_hee.log</title>
        <link>https://velog.io/</link>
        <description>개발일지👩🏻‍💻💻:)</description>
        <lastBuildDate>Fri, 21 Apr 2023 01:34:18 GMT</lastBuildDate>
        <docs>https://validator.w3.org/feed/docs/rss2.html</docs>
        <generator>https://github.com/jpmonette/feed</generator>
        <image>
            <title>woo_hee.log</title>
            <url>https://velog.velcdn.com/images/wo_he98/profile/e964b117-e2a4-49a0-93a2-308c352d0d5a/image.jpeg</url>
            <link>https://velog.io/</link>
        </image>
        <copyright>Copyright (C) 2019. woo_hee.log. All rights reserved.</copyright>
        <atom:link href="https://v2.velog.io/rss/wo_he98" rel="self" type="application/rss+xml"/>
        <item>
            <title><![CDATA[[2606]바이러스(Java)]]></title>
            <link>https://velog.io/@wo_he98/2606%EB%B0%94%EC%9D%B4%EB%9F%AC%EC%8A%A4Java</link>
            <guid>https://velog.io/@wo_he98/2606%EB%B0%94%EC%9D%B4%EB%9F%AC%EC%8A%A4Java</guid>
            <pubDate>Fri, 21 Apr 2023 01:34:18 GMT</pubDate>
            <description><![CDATA[<p><strong>문제</strong></p>
<blockquote>
<p>신종 바이러스인 웜 바이러스는 네트워크를 통해 전파된다. 한 컴퓨터가 웜 바이러스에 걸리면 그 컴퓨터와 네트워크 상에서 연결되어 있는 모든 컴퓨터는 웜 바이러스에 걸리게 된다.
예를 들어 7대의 컴퓨터가 &lt;그림 1&gt;과 같이 네트워크 상에서 연결되어 있다고 하자. 1번 컴퓨터가 웜 바이러스에 걸리면 웜 바이러스는 2번과 5번 컴퓨터를 거쳐 3번과 6번 컴퓨터까지 전파되어 2, 3, 5, 6 네 대의 컴퓨터는 웜 바이러스에 걸리게 된다. 하지만 4번과 7번 컴퓨터는 1번 컴퓨터와 네트워크상에서 연결되어 있지 않기 때문에 영향을 받지 않는다.
<img src="https://velog.velcdn.com/images/wo_he98/post/d06a4737-5f76-4a56-9eac-ad873a143e6b/image.png" alt="">
어느 날 1번 컴퓨터가 웜 바이러스에 걸렸다. 컴퓨터의 수와 네트워크 상에서 서로 연결되어 있는 정보가 주어질 때, 1번 컴퓨터를 통해 웜 바이러스에 걸리게 되는 컴퓨터의 수를 출력하는 프로그램을 작성하시오.</p>
</blockquote>
<p><strong>입력</strong>
첫째 줄에는 컴퓨터의 수가 주어진다. 컴퓨터의 수는 100 이하이고 각 컴퓨터에는 1번 부터 차례대로 번호가 매겨진다. 둘째 줄에는 네트워크 상에서 직접 연결되어 있는 컴퓨터 쌍의 수가 주어진다. 이어서 그 수만큼 한 줄에 한 쌍씩 네트워크 상에서 직접 연결되어 있는 컴퓨터의 번호 쌍이 주어진다.</p>
<p><strong>출력</strong>
1번 컴퓨터가 웜 바이러스에 걸렸을 때, 1번 컴퓨터를 통해 웜 바이러스에 걸리게 되는 컴퓨터의 수를 첫째 줄에 출력한다.</p>
<p><strong>풀이</strong></p>
<pre><code>import java.util.*;

class Main{

    static boolean[][] graph;
    static boolean[] visited;
    static int N, M;
    static int answer;

    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        N = sc.nextInt();
        M = sc.nextInt();

        graph = new boolean[N + 1][N + 1];
        visited = new boolean[N + 1];

        int x, y;
        for(int i = 0; i &lt; M; i++){
            x = sc.nextInt();
            y = sc.nextInt();
            graph[x][y] = graph[y][x] = true;
        }

        dfs(1);
        System.out.println(answer - 1);
        sc.close();
    }

    public static void dfs(int index){
        answer++;
        visited[index] = true;
        for(int i = 1; i &lt;= N; i++){
            if(!visited[i] &amp;&amp; graph[index][i]){
                dfs(i);
            }
        }
    }
}</code></pre>]]></description>
        </item>
        <item>
            <title><![CDATA[[1260]DFS와 BFS(Java)]]></title>
            <link>https://velog.io/@wo_he98/1260-DFS%EC%99%80-BFSJava</link>
            <guid>https://velog.io/@wo_he98/1260-DFS%EC%99%80-BFSJava</guid>
            <pubDate>Fri, 21 Apr 2023 00:53:46 GMT</pubDate>
            <description><![CDATA[<p><strong>문제</strong></p>
<blockquote>
<p>그래프를 DFS로 탐색한 결과와 BFS로 탐색한 결과를 출력하는 프로그램을 작성하시오. 단, 방문할 수 있는 정점이 여러 개인 경우에는 정점 번호가 작은 것을 먼저 방문하고, 더 이상 방문할 수 있는 점이 없는 경우 종료한다. 정점 번호는 1번부터 N번까지이다.</p>
</blockquote>
<p><strong>입력</strong>
첫째 줄에 정점의 개수 N(1 ≤ N ≤ 1,000), 간선의 개수 M(1 ≤ M ≤ 10,000), 탐색을 시작할 정점의 번호 V가 주어진다. 다음 M개의 줄에는 간선이 연결하는 두 정점의 번호가 주어진다. 어떤 두 정점 사이에 여러 개의 간선이 있을 수 있다. 입력으로 주어지는 간선은 양방향이다.</p>
<p><strong>출력</strong>
첫째 줄에 DFS를 수행한 결과를, 그 다음 줄에는 BFS를 수행한 결과를 출력한다. V부터 방문된 점을 순서대로 출력하면 된다.</p>
<p><strong>💡풀이</strong></p>
<pre><code>import java.util.*;

public class Main {

    static int[][] arr;
    static boolean[] visited;

    public static void main(String[] args){

        Scanner sc = new Scanner(System.in);

        int N = sc.nextInt();  
        int M = sc.nextInt();  
        int V = sc.nextInt();    

        arr = new int[N+1][N+1];

        for(int i = 0; i &lt; M; i++) {
            int a = sc.nextInt();
            int b = sc.nextInt();
            arr[a][b] = 1;
            arr[b][a] = 1;
        }

        visited = new boolean[N + 1];
        dfs(V);

        System.out.println();

        visited = new boolean[N + 1];

        bfs(V);

        System.out.println();
    }

    private static void dfs(int v) {
        visited[v] = true;
        System.out.print(v + &quot; &quot;);

        if(v == arr.length){
            return;
        }

        for(int j = 1; j &lt; arr.length; j++) { 
            if(arr[v][j] == 1 &amp;&amp; !visited[j]) {
                dfs(j);
            }
        }
    }

    private static void bfs(int v) {
        Queue&lt;Integer&gt; queue = new LinkedList&lt;Integer&gt;();
        queue.offer(v);
        visited[v] = true;

        System.out.print(v + &quot; &quot;);

        while(!queue.isEmpty()) {
            int n = queue.poll();

            for(int i = 1; i &lt; arr.length; i++) { 
                if(arr[n][i] == 1 &amp;&amp; !visited[i]) {
                    visited[i] = true;
                    System.out.print(i + &quot; &quot;);
                    queue.offer(i);
                }
            }
        }   
    }

}</code></pre>]]></description>
        </item>
        <item>
            <title><![CDATA[[2178]미로 탐색(Java)]]></title>
            <link>https://velog.io/@wo_he98/2178%EB%AF%B8%EB%A1%9C-%ED%83%90%EC%83%89Java</link>
            <guid>https://velog.io/@wo_he98/2178%EB%AF%B8%EB%A1%9C-%ED%83%90%EC%83%89Java</guid>
            <pubDate>Wed, 19 Apr 2023 09:45:25 GMT</pubDate>
            <description><![CDATA[<p><strong>문제</strong></p>
<blockquote>
<p>N×M크기의 배열로 표현되는 미로가 있다.
<img src="https://velog.velcdn.com/images/wo_he98/post/21eaf1c7-7301-4347-8a07-5cdb0a6b4fa1/image.png" alt=""></p>
</blockquote>
<p>미로에서 1은 이동할 수 있는 칸을 나타내고, 0은 이동할 수 없는 칸을 나타낸다. 이러한 미로가 주어졌을 때, (1, 1)에서 출발하여 (N, M)의 위치로 이동할 때 지나야 하는 최소의 칸 수를 구하는 프로그램을 작성하시오. 한 칸에서 다른 칸으로 이동할 때, 서로 인접한 칸으로만 이동할 수 있다.
위의 예에서는 15칸을 지나야 (N, M)의 위치로 이동할 수 있다. 칸을 셀 때에는 시작 위치와 도착 위치도 포함한다.</p>
<p><strong>입력</strong>
첫째 줄에 두 정수 N, M(2 ≤ N, M ≤ 100)이 주어진다. 다음 N개의 줄에는 M개의 정수로 미로가 주어진다. 각각의 수들은 붙어서 입력으로 주어진다.</p>
<p><strong>출력</strong>
첫째 줄에 지나야 하는 최소의 칸 수를 출력한다. 항상 도착위치로 이동할 수 있는 경우만 입력으로 주어진다.</p>
<p><strong>💡풀이</strong></p>
<pre><code>import java.util.*;
import java.io.*;

public class Main{

    static int[] dx = {1, 0, -1, 0};
    static int[] dy = {0, 1, 0, -1};
    static boolean[][] visited;
    static int[][] A;
    static int N, M;

    public static void main(String[] args) throws IOException{
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        StringTokenizer st = new StringTokenizer(br.readLine());
        N = Integer.parseInt(st.nextToken());
        M = Integer.parseInt(st.nextToken());
        A = new int[N][M];
        visited = new boolean[N][M];

        for(int i = 0; i &lt; N; i++){
            st = new StringTokenizer(br.readLine());
            String line = st.nextToken();
            for(int j = 0; j &lt; M; j++){
                A[i][j] = Integer.parseInt(line.substring(j, j+1));
            }
        }

        bfs(0,0); 
        System.out.print(A[N - 1][M - 1]);
    }

    private static void bfs(int i, int j){
        Queue&lt;int[]&gt; queue = new LinkedList&lt;&gt;();
        queue.offer(new int[]{i, j});
        visited[i][j] = true;

        while(!queue.isEmpty()){
            int now[] = queue.poll();
            for(int k = 0; k &lt; 4; k++){
                int x = now[0] + dx[k];
                int y = now[1] + dy[k];

                if(x &gt;= 0 &amp;&amp; y &gt;= 0 &amp;&amp; x &lt; N &amp;&amp; y &lt; M){
                    if(A[x][y] != 0 &amp;&amp; !visited[x][y]){
                        visited[x][y] = true;
                        A[x][y] = A[now[0]][now[1]] + 1;
                        queue.add(new int[]{x, y});
                    }
                }
            }
        }
    }


}</code></pre>]]></description>
        </item>
        <item>
            <title><![CDATA[Android KTX]]></title>
            <link>https://velog.io/@wo_he98/Android-KTX</link>
            <guid>https://velog.io/@wo_he98/Android-KTX</guid>
            <pubDate>Sat, 04 Mar 2023 05:32:42 GMT</pubDate>
            <description><![CDATA[<p><strong>1. Android KTX란</strong>
Android KTX는 Android Jetpack과 기타 Android 라이브러리에 포함된 Kotlin 확장 프로그램 세트입니다. KTX 확장 프로그램은 간결하고 직관적인 Kotlin을 Jetpack, Android 플랫폼, 기타 API에 제공합니다.</p>
</br>

<p><strong>2. 프로젝트에 Android KTX 사용</strong>
Android KTX 사용을 시작하려면 프로젝트의 build.gradle 파일에 다음 종속 항목을 추가합니다.</p>
<pre><code>repositories {
    google()
}</code></pre><br/>

<p><strong>3. Android KTX 모듈별 사용 예</strong></p>
<ul>
<li>CoreKTX
Core KTX 모듈은 Android 프레임워크의 일부인 일반 라이브러리에 확장 프로그램을 제공합니다. 이러한 라이브러리에는 build.gradle에 추가해야 하는 자바 기반 종속 항목이 없습니다.
이 모듈을 포함하려면 앱의 build.gradle 파일에 다음을 추가합니다.<pre><code>dependencies {
  implementation(&quot;androidx.core:core-ktx:1.9.0&quot;)
}</code></pre></li>
<li>Collection KTX
Collection 확장 프로그램에는 ArrayMap, LongSparseArray, LruCache 등 메모리 효율성이 높은 Android의 컬렉션 라이브러리와 호환되는 유틸리티 함수가 포함되어 있습니다.
이 모듈을 사용하려면 앱의 build.gradle 파일에 다음을 추가합니다.<pre><code>dependencies {
  implementation(&quot;androidx.collection:collection-ktx:1.2.0&quot;)
}</code></pre></li>
</ul>
<p>Collection 확장 프로그램은 다음 예와 같이 Kotlin의 연산자 오버로드를 활용하여 컬렉션 연결과 같은 작업을 단순화합니다.</p>
<pre><code>// Combine 2 ArraySets into 1.
val combinedArraySet = arraySetOf(1, 2, 3) + arraySetOf(4, 5, 6)

// Combine with numbers to create a new sets.
val newArraySet = combinedArraySet + 7 + 8</code></pre><ul>
<li>Fragment KTX
Fragment KTX 모듈은 여러 확장 프로그램을 제공하여 프래그먼트 API를 단순화합니다.
이 모듈을 포함하려면 앱의 build.gradle 파일에 다음을 추가합니다.</li>
</ul>
<pre><code>dependencies {
    implementation(&quot;androidx.fragment:fragment-ktx:1.5.5&quot;)
}</code></pre><p>Fragment KTX 모듈을 사용하면 다음과 같이 람다로 프래그먼트 트랜잭션을 단순화할 수 있습니다.</p>
<pre><code>fragmentManager().commit {
   addToBackStack(&quot;...&quot;)
   setCustomAnimations(
           R.anim.enter_anim,
           R.anim.exit_anim)
   add(fragment, &quot;...&quot;)
}
</code></pre><p>또한 다음과 같이 viewModels 및 activityViewModels 속성 위임을 사용하여 한 줄로 ViewModel에 결합할 수도 있습니다.</p>
<pre><code>// Get a reference to the ViewModel scoped to this Fragment
val viewModel by viewModels&lt;MyViewModel&gt;()

// Get a reference to the ViewModel scoped to its Activity
val viewModel by activityViewModels&lt;MyViewModel&gt;()
</code></pre><ul>
<li>Lifecycle KTX
Lifecycle KTX는 각 Lifecycle 객체의 LifecycleScope를 정의합니다. 이 범위에서 실행된 코루틴은 Lifecycle이 끝나면 제거됩니다. lifecycle.coroutineScope 또는 lifecycleOwner.lifecycleScope 속성을 사용하여 Lifecycle의 CoroutineScope에 액세스할 수 있습니다.
이 모듈을 포함하려면 앱의 build.gradle 파일에 다음을 추가합니다.<pre><code>dependencies {
  implementation(&quot;androidx.lifecycle:lifecycle-runtime-ktx:2.5.1&quot;)
}</code></pre></li>
</ul>
<p>아래 예는 lifecycleOwner.lifecycleScope를 사용하여 미리 계산된 텍스트를 비동기적으로 만드는 방법을 보여줍니다.</p>
<pre><code>class MyFragment: Fragment() {
    override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
        super.onViewCreated(view, savedInstanceState)
        viewLifecycleOwner.lifecycleScope.launch {
            val params = TextViewCompat.getTextMetricsParams(textView)
            val precomputedText = withContext(Dispatchers.Default) {
                PrecomputedTextCompat.create(longTextContent, params)
            }
            TextViewCompat.setPrecomputedText(textView, precomputedText)
        }
    }
}</code></pre><ul>
<li>LiveData KTX
LiveData를 사용할 때 값을 비동기적으로 계산해야 할 수 있습니다. 예를 들어 사용자의 환경설정을 검색하여 UI에 제공하려고 할 수 있습니다. 이런 상황에서 LiveData KTX는 liveData 빌더 함수를 제공함으로써 suspend 함수를 호출하여 그 결과를 LiveData 객체로 제공할 수 있습니다.
이 모듈을 포함하려면 앱의 build.gradle 파일에 다음을 추가합니다.</li>
</ul>
<pre><code>dependencies {
    implementation(&quot;androidx.lifecycle:lifecycle-livedata-ktx:2.5.1&quot;)
}</code></pre><p>다음 예에서 loadUser()는 다른 곳에서 선언된 정지 함수입니다. liveData 빌더 함수를 사용하여 loadUser()를 비동기적으로 호출한 후 emit()를 사용하여 결과를 내보낼 수 있습니다.</p>
<pre><code>val user: LiveData&lt;User&gt; = liveData {
    val data = database.loadUser() // loadUser is a suspend function.
    emit(data)
}</code></pre><ul>
<li>Navigation KTX
Navigation 라이브러리의 각 구성요소에는 API를 조정하여 더 간결하고 Kotlin 직관적이 되도록 하는 자체 KTX 버전이 있습니다.
이러한 모듈을 포함하려면 앱의 build.gradle 파일에 다음을 추가합니다.</li>
</ul>
<pre><code>dependencies {
    implementation(&quot;androidx.navigation:navigation-runtime-ktx:2.5.3&quot;)
    implementation(&quot;androidx.navigation:navigation-fragment-ktx:2.5.3&quot;)
    implementation(&quot;androidx.navigation:navigation-ui-ktx:2.5.3&quot;)
}</code></pre><p>다음 예와 같이 확장 함수 및 속성 위임을 사용하여 대상 인수에 액세스하고 대상을 탐색합니다.</p>
<pre><code>class MyDestination : Fragment() {

    // Type-safe arguments are accessed from the bundle.
    val args by navArgs&lt;MyDestinationArgs&gt;()

    ...
    override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
        view.findViewById&lt;Button&gt;(R.id.next)
            .setOnClickListener {
                // Fragment extension added to retrieve a NavController from
                // any destination.
                findNavController().navigate(R.id.action_to_next_destination)
            }
     }
     ...

}</code></pre><ul>
<li>Palette KTX
Palette KTX 모듈은 색상 팔레트 작업에 직관적인 Kotlin 지원을 제공합니다.
이 모듈을 사용하려면 앱의 build.gradle 파일에 다음을 추가합니다.</li>
</ul>
<pre><code>dependencies {
    implementation(&quot;androidx.palette:palette-ktx:1.0.0&quot;)
}</code></pre><p>예를 들어 Palette 인스턴스로 작업할 때 get 연산자([ ])를 사용하여 주어진 target의 selected 견본을 검색할 수 있습니다</p>
<pre><code>val palette = Palette.from(bitmap).generate()
val swatch = palette[target]</code></pre><ul>
<li>Reactive Streams KTX
Reactive Streams KTX 모듈을 사용하면 ReactiveStreams 게시자에서 식별 가능한 LiveData 스트림을 생성할 수 있습니다.
이 모듈을 포함하려면 앱의 build.gradle 파일에 다음을 추가합니다.</li>
</ul>
<pre><code>dependencies {
    implementation(&quot;androidx.lifecycle:lifecycle-reactivestreams-ktx:2.5.1&quot;)
}</code></pre><p>예를 들어 작은 사용자 목록이 있는 데이터베이스를 가정해보겠습니다. 앱에서 데이터베이스를 메모리로 로드한 다음 UI에 사용자 데이터를 표시합니다. 이를 위해 RxJava를 사용할 수 있습니다. Room Jetpack 구성요소는 사용자 목록을 Flowable로 검색할 수 있습니다. 이 시나리오에서는 프래그먼트나 활동의 수명 전체에 걸쳐 Rx 게시자 구독도 관리해야 합니다.</p>
<p>그러나 다음 예와 같이 LiveDataReactiveStreams를 사용하면 RxJava 및 다양한 연산자 세트와 작업 일정 예약 기능의 이점은 물론 LiveData의 단순성이라는 이점도 누릴 수 있습니다.</p>
<pre><code>val fun getUsersLiveData() : LiveData&lt;List&lt;User&gt;&gt; {
    val users: Flowable&lt;List&lt;User&gt;&gt; = dao.findUsers()
    return LiveDataReactiveStreams.fromPublisher(users)
}</code></pre><ul>
<li>Room KTX
Room 확장 프로그램은 데이터베이스 트랜잭션을 위한 코루틴 지원을 추가합니다.
이 모듈을 사용하려면 앱의 build.gradle 파일에 다음을 추가합니다.</li>
</ul>
<pre><code>dependencies {
    implementation(&quot;androidx.room:room-ktx:2.5.0&quot;)
}</code></pre><p>다음은 Room에서 현재 코루틴을 사용하는 몇 가지 예입니다. 첫 번째 예에서는 suspend 함수를 사용하여 User 객체 목록을 반환하는 반면 두 번째 예에서는 Kotlin의 Flow를 활용하여 User 목록을 비동기적으로 반환합니다. Flow 사용 시 쿼리 중인 테이블의 변경사항 알림을 받습니다.</p>
<pre><code>@Query(&quot;SELECT * FROM Users&quot;)
suspend fun getUsers(): List&lt;User&gt;

@Query(&quot;SELECT * FROM Users&quot;)
fun getUsers(): Flow&lt;List&lt;User&gt;&gt;</code></pre><ul>
<li>SQLite KTX
SQLite 확장 프로그램은 트랜잭션에서 SQL 관련 코드를 래핑하여 여러 상용구 코드를 제거합니다.
이 모듈을 사용하려면 앱의 build.gradle 파일에 다음을 추가합니다.</li>
</ul>
<pre><code>dependencies {
    implementation(&quot;androidx.sqlite:sqlite-ktx:2.3.0&quot;)
}</code></pre><p>다음은 transaction 확장을 사용하여 데이터베이스 트랜잭션을 실행하는 예입니다.</p>
<pre><code>db.transaction {
    // insert data
}</code></pre><ul>
<li>ViewModel KTX
ViewModel KTX 라이브러리는 viewModelScope() 함수를 제공합니다. 이 함수로 ViewModel에서 코루틴을 실행하기가 더 쉬워집니다. CoroutineScope는 Dispatchers.Main에 바인딩되며 ViewModel이 삭제되면 자동으로 취소됩니다. 각 ViewModel에 새로운 범위를 만드는 대신 viewModelScope()를 사용할 수 있습니다.
이 모듈을 포함하려면 앱의 build.gradle 파일에 다음을 추가합니다.</li>
</ul>
<pre><code>dependencies {
    implementation(&quot;androidx.lifecycle:lifecycle-viewmodel-ktx:2.5.1&quot;)
}</code></pre><p>예를 들어 다음 viewModelScope() 함수는 백그라운드 스레드에서 네트워크를 요청하는 코루틴을 실행합니다. 라이브러리는 모든 설정 및 상응하는 범위 삭제를 처리합니다.</p>
<pre><code>class MainViewModel : ViewModel() {
    // Make a network request without blocking the UI thread
    private fun makeNetworkRequest() {
        // launch a coroutine in viewModelScope
        viewModelScope.launch  {
            remoteApi.slowFetch()
            ...
        }
    }

    // No need to override onCleared()
}</code></pre><ul>
<li>WorkManager KTX
WorkManager KTX는 코루틴을 위한 최고 수준의 지원을 제공합니다.
이 모듈을 포함하려면 앱의 build.gradle 파일에 다음을 추가합니다.</li>
</ul>
<pre><code>dependencies {
    implementation(&quot;androidx.work:work-runtime-ktx:2.8.0&quot;)
}</code></pre><p>Worker를 확장하는 대신 API가 약간 다른 CoroutineWorker를 확장할 수 있습니다. 예를 들어 간단한 CoroutineWorker를 빌드하여 일부 네트워크 작업을 실행하려면 다음과 같이 하면 됩니다.</p>
<pre><code>class CoroutineDownloadWorker(context: Context, params: WorkerParameters)
        : CoroutineWorker(context, params) {

    override suspend fun doWork(): Result = coroutineScope {
        val jobs = (0 until 100).map {
            async {
                downloadSynchronously(&quot;https://www.google.com&quot;)
            }
        }

        // awaitAll will throw an exception if a download fails, which
        // CoroutineWorker will treat as a failure
        jobs.awaitAll()
        Result.success()
    }
}</code></pre><p>또한 WorkManager KTX는 Operations 및 ListenableFutures에 확장 함수를 추가하여 현재 코루틴을 정지합니다.</p>
<p>다음은 enqueue()에 의해 반환된 Operation을 정지하는 예입니다.</p>
<pre><code>// Inside of a coroutine...

// Run async operation and suspend until completed.
WorkManager.getInstance()
        .beginWith(longWorkRequest)
        .enqueue().await()

// Resume after work completes...</code></pre><br>

<p><strong>4. 기타 KTX 모듈</strong>
또한 AndroidX 외부에 있는 추가 KTX 모듈을 포함할 수도 있습니다.</p>
<ul>
<li><p>Firebase KTX
일부 Android용 Firebase SDK에는 앱에서 Firebase를 사용할 때 직관적인 Kotlin 코드를 작성할 수 있게 하는 Kotlin 확장 라이브러리가 있습니다. </p>
</li>
<li><p>Google Maps Platform KTX
Google Maps Platform Android SDK에 사용할 수 있는 KTX 확장 프로그램이 있으며 이를 사용하면 확장 함수, 명명된 매개변수와 기본 인수, 구조 파괴 선언, 코루틴과 같은 여러 Kotlin 언어 기능을 활용할 수 있습니다</p>
</li>
<li><p>Play Core KTX
Play Core KTX는 Play Core 라이브러리의 SplitInstallManager 및 AppUpdateManager에 확장 함수를 추가하여 원샷 요청의 Kotlin 코루틴 지원 및 상태 업데이트 모니터링의 Flow 지원을 추가합니다.
이 모듈을 포함하려면 앱의 build.gradle 파일에 다음을 추가합니다.</p>
</li>
</ul>
<pre><code>dependencies {
    implementation(&quot;com.google.android.play:core-ktx:1.8.1&quot;)
}</code></pre><p>다음은 상태 모니터링 Flow의 예입니다.</p>
<pre><code>// Inside of a coroutine...

// Request in-app update status updates.
manager.requestUpdateFlow().collect { updateResult -&gt;
    when (updateResult) {
        is AppUpdateResult.Available -&gt; TODO()
        is AppUpdateResult.InProgress -&gt; TODO()
        is AppUpdateResult.Downloaded -&gt; TODO()
        AppUpdateResult.NotAvailable -&gt; TODO()
    }
}</code></pre>]]></description>
        </item>
        <item>
            <title><![CDATA[[Lv.1] 개인정보 수집 유효기간(Java)]]></title>
            <link>https://velog.io/@wo_he98/Lv.1-%EA%B0%9C%EC%9D%B8%EC%A0%95%EB%B3%B4-%EC%88%98%EC%A7%91-%EC%9C%A0%ED%9A%A8%EA%B8%B0%EA%B0%84Java</link>
            <guid>https://velog.io/@wo_he98/Lv.1-%EA%B0%9C%EC%9D%B8%EC%A0%95%EB%B3%B4-%EC%88%98%EC%A7%91-%EC%9C%A0%ED%9A%A8%EA%B8%B0%EA%B0%84Java</guid>
            <pubDate>Mon, 23 Jan 2023 11:04:19 GMT</pubDate>
            <description><![CDATA[<p><strong>문제</strong></p>
<blockquote>
<p>고객의 약관 동의를 얻어서 수집된 1~n번으로 분류되는 개인정보 n개가 있습니다. 약관 종류는 여러 가지 있으며 각 약관마다 개인정보 보관 유효기간이 정해져 있습니다. 당신은 각 개인정보가 어떤 약관으로 수집됐는지 알고 있습니다. 수집된 개인정보는 유효기간 전까지만 보관 가능하며, 유효기간이 지났다면 반드시 파기해야 합니다.</p>
</blockquote>
<p>예를 들어, A라는 약관의 유효기간이 12 달이고, 2021년 1월 5일에 수집된 개인정보가 A약관으로 수집되었다면 해당 개인정보는 2022년 1월 4일까지 보관 가능하며 2022년 1월 5일부터 파기해야 할 개인정보입니다.
당신은 오늘 날짜로 파기해야 할 개인정보 번호들을 구하려 합니다.</p>
<blockquote>
</blockquote>
<p>모든 달은 28일까지 있다고 가정합니다.</p>
<blockquote>
</blockquote>
<p>다음은 오늘 날짜가 2022.05.19일 때의 예시입니다.</p>
<blockquote>
</blockquote>
<table>
<thead>
<tr>
<th align="left">약관 종류</th>
<th align="left">유효기간</th>
</tr>
</thead>
<tbody><tr>
<td align="left">A</td>
<td align="left">6달</td>
</tr>
<tr>
<td align="left">B</td>
<td align="left">12달</td>
</tr>
<tr>
<td align="left">C</td>
<td align="left">3달</td>
</tr>
</tbody></table>
<blockquote>
<br/>

</blockquote>
<table>
<thead>
<tr>
<th align="left">번호</th>
<th align="left">개인정보 수집 일자</th>
<th align="left">약관 종류</th>
</tr>
</thead>
<tbody><tr>
<td align="left">1</td>
<td align="left">2021.05.02</td>
<td align="left">A</td>
</tr>
<tr>
<td align="left">2</td>
<td align="left">2021.07.01</td>
<td align="left">B</td>
</tr>
<tr>
<td align="left">3</td>
<td align="left">2022.02.19</td>
<td align="left">C</td>
</tr>
<tr>
<td align="left">4</td>
<td align="left">2022.02.20</td>
<td align="left">C</td>
</tr>
</tbody></table>
<blockquote>
</blockquote>
<ul>
<li>첫 번째 개인정보는 A약관에 의해 2021년 11월 1일까지 보관 가능하며, 유효기간이 지났으므로 파기해야 할 개인정보입니다.</li>
<li>두 번째 개인정보는 B약관에 의해 2022년 6월 28일까지 보관 가능하며, 유효기간이 지나지 않았으므로 아직 보관 가능합니다.</li>
<li>세 번째 개인정보는 C약관에 의해 2022년 5월 18일까지 보관 가능하며, 유효기간이 지났으므로 파기해야 할 개인정보입니다.</li>
<li>네 번째 개인정보는 C약관에 의해 2022년 5월 19일까지 보관 가능하며, 유효기간이 지나지 않았으므로 아직 보관 가능합니다.<blockquote>
</blockquote>
따라서 파기해야 할 개인정보 번호는 [1, 3]입니다.<br/>
오늘 날짜를 의미하는 문자열 today, 약관의 유효기간을 담은 1차원 문자열 배열 terms와 수집된 개인정보의 정보를 담은 1차원 문자열 배열 privacies가 매개변수로 주어집니다. 이때 파기해야 할 개인정보의 번호를 오름차순으로 1차원 정수 배열에 담아 return 하도록 solution 함수를 완성해 주세요.</li>
</ul>
<p><strong>제한사항</strong></p>
<ul>
<li>today는 &quot;YYYY.MM.DD&quot; 형태로 오늘 날짜를 나타냅니다.</li>
<li>1 ≤ terms의 길이 ≤ 20<ul>
<li>terms의 원소는 &quot;약관 종류 유효기간&quot; 형태의 약관 종류와 유효기간을 공백 하나로 구분한 문자열입니다.</li>
<li>약관 종류는 A~Z중 알파벳 대문자 하나이며, terms 배열에서 약관 종류는 중복되지 않습니다.</li>
<li>유효기간은 개인정보를 보관할 수 있는 달 수를 나타내는 정수이며, 1 이상 100 이하입니다.</li>
</ul>
</li>
<li>1 ≤ privacies의 길이 ≤ 100<ul>
<li>privacies[i]는 i+1번 개인정보의 수집 일자와 약관 종류를 나타냅니다.</li>
<li>privacies의 원소는 &quot;날짜 약관 종류&quot; 형태의 날짜와 약관 종류를 공백 하나로 구분한 문자열입니다.</li>
<li>날짜는 &quot;YYYY.MM.DD&quot; 형태의 개인정보가 수집된 날짜를 나타내며, today 이전의 날짜만 주어집니다.</li>
<li>privacies의 약관 종류는 항상 terms에 나타난 약관 종류만 주어집니다.</li>
</ul>
</li>
<li>today와 privacies에 등장하는 날짜의 YYYY는 연도, MM은 월, DD는 일을 나타내며 점(.) 하나로 구분되어 있습니다.<ul>
<li>2000 ≤ YYYY ≤ 2022</li>
<li>1 ≤ MM ≤ 12</li>
<li>MM이 한 자릿수인 경우 앞에 0이 붙습니다.</li>
<li>1 ≤ DD ≤ 28</li>
<li>DD가 한 자릿수인 경우 앞에 0이 붙습니다.</li>
</ul>
</li>
<li>파기해야 할 개인정보가 하나 이상 존재하는 입력만 주어집니다.</li>
</ul>
<p><strong>입출력 예</strong></p>
<table>
<thead>
<tr>
<th align="left">today</th>
<th align="left">terms</th>
<th align="left">privacies</th>
<th align="left">result</th>
</tr>
</thead>
<tbody><tr>
<td align="left">&quot;2022.05.19&quot;</td>
<td align="left">[&quot;A 6&quot;, &quot;B 12&quot;, &quot;C 3&quot;]</td>
<td align="left">[&quot;2021.05.02 A&quot;, &quot;2021.07.01 B&quot;, &quot;2022.02.19 C&quot;, &quot;2022.02.20 C&quot;]</td>
<td align="left">[1, 3]</td>
</tr>
<tr>
<td align="left">&quot;2020.01.01&quot;</td>
<td align="left">[&quot;Z 3&quot;, &quot;D 5&quot;]</td>
<td align="left">[&quot;2019.01.01 D&quot;, &quot;2019.11.15 Z&quot;, &quot;2019.08.02 D&quot;, &quot;2019.07.01 D&quot;, &quot;2018.12.28 Z&quot;]</td>
<td align="left">[1, 4, 5]</td>
</tr>
</tbody></table>
<p><strong>입출력 예 설명</strong></p>
<p>입출력 예 #1
문제 예시와 같습니다.</p>
<p>입출력 예 #2</p>
<table>
<thead>
<tr>
<th align="left">약관 종류</th>
<th align="left">유효기간</th>
</tr>
</thead>
<tbody><tr>
<td align="left">Z</td>
<td align="left">3달</td>
</tr>
<tr>
<td align="left">D</td>
<td align="left">5달</td>
</tr>
<tr>
<td align="left"><br/></td>
<td align="left"></td>
</tr>
</tbody></table>
<table>
<thead>
<tr>
<th align="left">번호</th>
<th align="left">개인정보 수집 일자</th>
<th align="left">약관 종류</th>
</tr>
</thead>
<tbody><tr>
<td align="left">1</td>
<td align="left">2019.01.01</td>
<td align="left">D</td>
</tr>
<tr>
<td align="left">2</td>
<td align="left">2019.11.15</td>
<td align="left">Z</td>
</tr>
<tr>
<td align="left">3</td>
<td align="left">2019.08.02</td>
<td align="left">D</td>
</tr>
<tr>
<td align="left">4</td>
<td align="left">2019.07.01</td>
<td align="left">D</td>
</tr>
<tr>
<td align="left">5</td>
<td align="left">2018.12.28</td>
<td align="left">Z</td>
</tr>
</tbody></table>
<p>오늘 날짜는 2020년 1월 1일입니다.</p>
<ul>
<li>첫 번째 개인정보는 D약관에 의해 2019년 5월 28일까지 보관 가능하며, 유효기간이 지났으므로 파기해야 할 개인정보입니다.</li>
<li>두 번째 개인정보는 Z약관에 의해 2020년 2월 14일까지 보관 가능하며, 유효기간이 지나지 않았으므로 아직 보관 가능합니다.</li>
<li>세 번째 개인정보는 D약관에 의해 2020년 1월 1일까지 보관 가능하며, 유효기간이 지나지 않았으므로 아직 보관 가능합니다.</li>
<li>네 번째 개인정보는 D약관에 의해 2019년 11월 28일까지 보관 가능하며, 유효기간이 지났으므로 파기해야 할 개인정보입니다.</li>
<li>다섯 번째 개인정보는 Z약관에 의해 2019년 3월 27일까지 보관 가능하며, 유효기간이 지났으므로 파기해야 할 개인정보입니다.</li>
</ul>
<hr>
<p><strong>💡풀이</strong></p>
<pre><code>import java.util.*;

class Solution {
    public int[] solution(String today, String[] terms, String[] privacies) {
        ArrayList&lt;Integer&gt; answer = new ArrayList&lt;&gt;();
        HashMap&lt;String, Integer&gt; map = new HashMap&lt;&gt;();

        int date = getDate(today);

        for (String s : terms) {
            String[] term = s.split(&quot; &quot;);
            map.put(term[0], Integer.parseInt(term[1]));
        }

        for (int i = 0; i &lt; privacies.length; i++) {
            String[] privacy = privacies[i].split(&quot; &quot;);

            if (getDate(privacy[0]) + (map.get(privacy[1]) * 28) &lt;= date) {
                answer.add(i + 1);
            }
        }
        return answer.stream().mapToInt(integer -&gt; integer).toArray();
    }

    private int getDate(String today) {
        String[] date = today.split(&quot;\\.&quot;);
        int year = Integer.parseInt(date[0]);
        int month = Integer.parseInt(date[1]);
        int day = Integer.parseInt(date[2]);
        return (year * 12 * 28) + (month * 28) + day;
    }
}</code></pre>]]></description>
        </item>
        <item>
            <title><![CDATA[[Lv.1] 크기가 작은 부분문자열(Java)]]></title>
            <link>https://velog.io/@wo_he98/Lv.1-%ED%81%AC%EA%B8%B0%EA%B0%80-%EC%9E%91%EC%9D%80-%EB%B6%80%EB%B6%84%EB%AC%B8%EC%9E%90%EC%97%B4Java</link>
            <guid>https://velog.io/@wo_he98/Lv.1-%ED%81%AC%EA%B8%B0%EA%B0%80-%EC%9E%91%EC%9D%80-%EB%B6%80%EB%B6%84%EB%AC%B8%EC%9E%90%EC%97%B4Java</guid>
            <pubDate>Mon, 23 Jan 2023 10:51:12 GMT</pubDate>
            <description><![CDATA[<p><strong>문제</strong></p>
<blockquote>
<p>숫자로 이루어진 문자열 t와 p가 주어질 때, t에서 p와 길이가 같은 부분문자열 중에서, 이 부분문자열이 나타내는 수가 p가 나타내는 수보다 작거나 같은 것이 나오는 횟수를 return하는 함수 solution을 완성하세요.
예를 들어, t=&quot;3141592&quot;이고 p=&quot;271&quot; 인 경우, t의 길이가 3인 부분 문자열은 314, 141, 415, 159, 592입니다. 이 문자열이 나타내는 수 중 271보다 작거나 같은 수는 141, 159 2개 입니다.</p>
</blockquote>
<p><strong>제한사항</strong></p>
<ul>
<li>1 ≤ p의 길이 ≤ 18</li>
<li>p의 길이 ≤ t의 길이 ≤ 10,000</li>
<li>t와 p는 숫자로만 이루어진 문자열이며, 0으로 시작하지 않습니다.</li>
</ul>
<p><strong>입출력 예</strong></p>
<table>
<thead>
<tr>
<th align="left">t</th>
<th align="left">p</th>
<th align="left">result</th>
</tr>
</thead>
<tbody><tr>
<td align="left">&quot;3141592&quot;</td>
<td align="left">&quot;271&quot;</td>
<td align="left">2</td>
</tr>
<tr>
<td align="left">&quot;500220839878&quot;</td>
<td align="left">&quot;7&quot;</td>
<td align="left">8</td>
</tr>
<tr>
<td align="left">&quot;10203&quot;</td>
<td align="left">&quot;15&quot;</td>
<td align="left">3</td>
</tr>
</tbody></table>
<p><strong>입출력 예 설명</strong></p>
<p>입출력 예 #1
본문과 같습니다.</p>
<p>입출력 예 #2
p의 길이가 1이므로 t의 부분문자열은 &quot;5&quot;, &quot;0&quot;, 0&quot;, &quot;2&quot;, &quot;2&quot;, &quot;0&quot;, &quot;8&quot;, &quot;3&quot;, &quot;9&quot;, &quot;8&quot;, &quot;7&quot;, &quot;8&quot;이며 이중 7보다 작거나 같은 숫자는 &quot;5&quot;, &quot;0&quot;, &quot;0&quot;, &quot;2&quot;, &quot;2&quot;, &quot;0&quot;, &quot;3&quot;, &quot;7&quot; 이렇게 8개가 있습니다.</p>
<p>입출력 예 #3
p의 길이가 2이므로 t의 부분문자열은 &quot;10&quot;, &quot;02&quot;, &quot;20&quot;, &quot;03&quot;이며, 이중 15보다 작거나 같은 숫자는 &quot;10&quot;, &quot;02&quot;, &quot;03&quot; 이렇게 3개입니다. &quot;02&quot;와 &quot;03&quot;은 각각 2, 3에 해당한다는 점에 주의하세요</p>
<hr>
<p><strong>💡풀이</strong></p>
<pre><code>class Solution {
    public int solution(String t, String p) {
        int answer = 0;

        for(int i = 0; i &lt;= t.length() - p.length(); i++){
            if(Long.parseLong(t.substring(i, i + p.length())) &lt;= Long.parseLong(p)){
                answer++;
            }
        }
        return answer;
    }
}</code></pre>]]></description>
        </item>
        <item>
            <title><![CDATA[[Lv.1] 가장 가까운 같은 글자(Java)]]></title>
            <link>https://velog.io/@wo_he98/Lv.1-%EA%B0%80%EC%9E%A5-%EA%B0%80%EA%B9%8C%EC%9A%B4-%EA%B0%99%EC%9D%80-%EA%B8%80%EC%9E%90Java</link>
            <guid>https://velog.io/@wo_he98/Lv.1-%EA%B0%80%EC%9E%A5-%EA%B0%80%EA%B9%8C%EC%9A%B4-%EA%B0%99%EC%9D%80-%EA%B8%80%EC%9E%90Java</guid>
            <pubDate>Mon, 23 Jan 2023 10:48:28 GMT</pubDate>
            <description><![CDATA[<p><strong>문제</strong></p>
<blockquote>
<p>문자열 s가 주어졌을 때, s의 각 위치마다 자신보다 앞에 나왔으면서, 자신과 가장 가까운 곳에 있는 같은 글자가 어디 있는지 알고 싶습니다.
예를 들어, s=&quot;banana&quot;라고 할 때,  각 글자들을 왼쪽부터 오른쪽으로 읽어 나가면서 다음과 같이 진행할 수 있습니다.</p>
</blockquote>
<ul>
<li>b는 처음 나왔기 때문에 자신의 앞에 같은 글자가 없습니다. 이는 -1로 표현합니다.</li>
<li>a는 처음 나왔기 때문에 자신의 앞에 같은 글자가 없습니다. 이는 -1로 표현합니다.</li>
<li>n은 처음 나왔기 때문에 자신의 앞에 같은 글자가 없습니다. 이는 -1로 표현합니다.</li>
<li>a는 자신보다 두 칸 앞에 a가 있습니다. 이는 2로 표현합니다.</li>
<li>n도 자신보다 두 칸 앞에 n이 있습니다. 이는 2로 표현합니다.</li>
<li>a는 자신보다 두 칸, 네 칸 앞에 a가 있습니다. 이 중 가까운 것은 두 칸 앞이고, 이는 2로 표현합니다.
따라서 최종 결과물은 [-1, -1, -1, 2, 2, 2]가 됩니다.
문자열 s이 주어질 때, 위와 같이 정의된 연산을 수행하는 함수 solution을 완성해주세요.</li>
</ul>
<p><strong>제한사항</strong></p>
<ul>
<li>1 ≤ s의 길이 ≤ 10,000<ul>
<li>s은 영어 소문자로만 이루어져 있습니다.</li>
</ul>
</li>
</ul>
<p><strong>입출력 예</strong></p>
<table>
<thead>
<tr>
<th align="left">s</th>
<th align="left">result</th>
</tr>
</thead>
<tbody><tr>
<td align="left">&quot;banana&quot;</td>
<td align="left">[-1, -1, -1, 2, 2, 2]</td>
</tr>
<tr>
<td align="left">&quot;foobar&quot;</td>
<td align="left">[-1, -1, 1, -1, -1, -1]</td>
</tr>
</tbody></table>
<p><strong>입출력 예 설명</strong></p>
<p>입출력 예 #1
지문과 같습니다.</p>
<p>입출력 예 #2
설명 생략</p>
<hr>
<p><strong>💡풀이</strong></p>
<pre><code>class Solution {
    public int[] solution(String s) {
        int[] answer = new int[s.length()];
        answer[0] = -1;
        for(int i = 1; i &lt; s.length(); i++){
            for(int j = i-1; j &gt;= 0; j--){
                if(s.charAt(i) == s.charAt(j)){
                    answer[i] = i - j;
                    break;
                }
            }
            if(answer[i] == 0) answer[i] = -1;
        }
        return answer;
    }
}</code></pre>]]></description>
        </item>
        <item>
            <title><![CDATA[[Lv.1] 폰켓몬(Java)]]></title>
            <link>https://velog.io/@wo_he98/Lv.1-%ED%8F%B0%EC%BC%93%EB%AA%ACJava</link>
            <guid>https://velog.io/@wo_he98/Lv.1-%ED%8F%B0%EC%BC%93%EB%AA%ACJava</guid>
            <pubDate>Wed, 14 Dec 2022 13:57:35 GMT</pubDate>
            <description><![CDATA[<p><strong>문제</strong></p>
<blockquote>
<p>당신은 폰켓몬을 잡기 위한 오랜 여행 끝에, 홍 박사님의 연구실에 도착했습니다. 홍 박사님은 당신에게 자신의 연구실에 있는 총 N 마리의 폰켓몬 중에서 N/2마리를 가져가도 좋다고 했습니다.
홍 박사님 연구실의 폰켓몬은 종류에 따라 번호를 붙여 구분합니다. 따라서 같은 종류의 폰켓몬은 같은 번호를 가지고 있습니다. 예를 들어 연구실에 총 4마리의 폰켓몬이 있고, 각 폰켓몬의 종류 번호가 [3번, 1번, 2번, 3번]이라면 이는 3번 폰켓몬 두 마리, 1번 폰켓몬 한 마리, 2번 폰켓몬 한 마리가 있음을 나타냅니다. 이때, 4마리의 폰켓몬 중 2마리를 고르는 방법은 다음과 같이 6가지가 있습니다.</p>
</blockquote>
<ol>
<li>첫 번째(3번), 두 번째(1번) 폰켓몬을 선택</li>
<li>첫 번째(3번), 세 번째(2번) 폰켓몬을 선택</li>
<li>첫 번째(3번), 네 번째(3번) 폰켓몬을 선택</li>
<li>두 번째(1번), 세 번째(2번) 폰켓몬을 선택</li>
<li>두 번째(1번), 네 번째(3번) 폰켓몬을 선택</li>
<li>세 번째(2번), 네 번째(3번) 폰켓몬을 선택
이때, 첫 번째(3번) 폰켓몬과 네 번째(3번) 폰켓몬을 선택하는 방법은 한 종류(3번 폰켓몬 두 마리)의 폰켓몬만 가질 수 있지만, 다른 방법들은 모두 두 종류의 폰켓몬을 가질 수 있습니다. 따라서 위 예시에서 가질 수 있는 폰켓몬 종류 수의 최댓값은 2가 됩니다.
당신은 최대한 다양한 종류의 폰켓몬을 가지길 원하기 때문에, 최대한 많은 종류의 폰켓몬을 포함해서 N/2마리를 선택하려 합니다. N마리 폰켓몬의 종류 번호가 담긴 배열 nums가 매개변수로 주어질 때, N/2마리의 폰켓몬을 선택하는 방법 중, 가장 많은 종류의 폰켓몬을 선택하는 방법을 찾아, 그때의 폰켓몬 종류 번호의 개수를 return 하도록 solution 함수를 완성해주세요.</li>
</ol>
<p><strong>제한사항</strong></p>
<ul>
<li>nums는 폰켓몬의 종류 번호가 담긴 1차원 배열입니다.</li>
<li>nums의 길이(N)는 1 이상 10,000 이하의 자연수이며, 항상 짝수로 주어집니다.</li>
<li>폰켓몬의 종류 번호는 1 이상 200,000 이하의 자연수로 나타냅니다.</li>
<li>가장 많은 종류의 폰켓몬을 선택하는 방법이 여러 가지인 경우에도, 선택할 수 있는 폰켓몬 종류 개수의 최댓값 하나만 return 하면 됩니다.</li>
</ul>
<p><strong>입출력 예</strong></p>
<table>
<thead>
<tr>
<th align="left">nums</th>
<th align="left">result</th>
</tr>
</thead>
<tbody><tr>
<td align="left">[3,1,2,3]</td>
<td align="left">2</td>
</tr>
<tr>
<td align="left">[3,3,3,2,2,4]</td>
<td align="left">3</td>
</tr>
<tr>
<td align="left">[3,3,3,2,2,2]</td>
<td align="left">2</td>
</tr>
</tbody></table>
<p><strong>입출력 예 설명</strong></p>
<p>입출력 예 #1
문제의 예시와 같습니다.</p>
<p>입출력 예 #2
6마리의 폰켓몬이 있으므로, 3마리의 폰켓몬을 골라야 합니다.
가장 많은 종류의 폰켓몬을 고르기 위해서는 3번 폰켓몬 한 마리, 2번 폰켓몬 한 마리, 4번 폰켓몬 한 마리를 고르면 되며, 따라서 3을 return 합니다.</p>
<p>입출력 예 #3
6마리의 폰켓몬이 있으므로, 3마리의 폰켓몬을 골라야 합니다.
가장 많은 종류의 폰켓몬을 고르기 위해서는 3번 폰켓몬 한 마리와 2번 폰켓몬 두 마리를 고르거나, 혹은 3번 폰켓몬 두 마리와 2번 폰켓몬 한 마리를 고르면 됩니다. 따라서 최대 고를 수 있는 폰켓몬 종류의 수는 2입니다.</p>
<hr>
<p>💡<strong>풀이</strong></p>
<pre><code>import java.util.*;

class Solution {
    public int solution(int[] nums) {
        int n = nums.length / 2;

        HashSet&lt;Integer&gt; set = new HashSet&lt;&gt;();

        for(int i = 0; i &lt; nums.length; i++){
            set.add(nums[i]);
        }

        return n &lt; set.size() ? n : set.size();
    }
}</code></pre>]]></description>
        </item>
        <item>
            <title><![CDATA[[Lv.1] 2016년(Java)]]></title>
            <link>https://velog.io/@wo_he98/Lv.1-2016%EB%85%84Java</link>
            <guid>https://velog.io/@wo_he98/Lv.1-2016%EB%85%84Java</guid>
            <pubDate>Wed, 14 Dec 2022 13:02:58 GMT</pubDate>
            <description><![CDATA[<p><strong>문제</strong></p>
<blockquote>
<p>2016년 1월 1일은 금요일입니다. 2016년 a월 b일은 무슨 요일일까요? 두 수 a ,b를 입력받아 2016년 a월 b일이 무슨 요일인지 리턴하는 함수, solution을 완성하세요. 요일의 이름은 일요일부터 토요일까지 각각 SUN,MON,TUE,WED,THU,FRI,SAT입니다. 예를 들어 a=5, b=24라면 5월 24일은 화요일이므로 문자열 &quot;TUE&quot;를 반환하세요.</p>
</blockquote>
<p><strong>제한사항</strong></p>
<ul>
<li>2016년은 윤년입니다.</li>
<li>2016년 a월 b일은 실제로 있는 날입니다. (13월 26일이나 2월 45일같은 날짜는 주어지지 않습니다)</li>
</ul>
<p><strong>입출력 예</strong></p>
<table>
<thead>
<tr>
<th align="left">a</th>
<th align="left">b</th>
<th align="left">result</th>
</tr>
</thead>
<tbody><tr>
<td align="left">5</td>
<td align="left">24</td>
<td align="left">&quot;TUE&quot;</td>
</tr>
</tbody></table>
<hr>
<p>💡<strong>풀이</strong></p>
<pre><code>import java.time.*;

class Solution {
    public String solution(int a, int b) {
        return LocalDate.of(2016, a, b).getDayOfWeek().toString().substring(0,3);
    }
}</code></pre>]]></description>
        </item>
        <item>
            <title><![CDATA[[Lv.1] 가운데 글자 가져오기(Java)]]></title>
            <link>https://velog.io/@wo_he98/Lv.1-%EA%B0%80%EC%9A%B4%EB%8D%B0-%EA%B8%80%EC%9E%90-%EA%B0%80%EC%A0%B8%EC%98%A4%EA%B8%B0Java</link>
            <guid>https://velog.io/@wo_he98/Lv.1-%EA%B0%80%EC%9A%B4%EB%8D%B0-%EA%B8%80%EC%9E%90-%EA%B0%80%EC%A0%B8%EC%98%A4%EA%B8%B0Java</guid>
            <pubDate>Wed, 14 Dec 2022 13:01:34 GMT</pubDate>
            <description><![CDATA[<p><strong>문제</strong></p>
<blockquote>
<p>단어 s의 가운데 글자를 반환하는 함수, solution을 만들어 보세요. 단어의 길이가 짝수라면 가운데 두글자를 반환하면 됩니다.</p>
</blockquote>
<p><strong>제한사항</strong></p>
<ul>
<li>s는 길이가 1 이상, 100이하인 스트링입니다.</li>
</ul>
<p><strong>입출력 예</strong></p>
<table>
<thead>
<tr>
<th align="left">s</th>
<th align="left">return</th>
</tr>
</thead>
<tbody><tr>
<td align="left">&quot;abcde&quot;</td>
<td align="left">&quot;c&quot;</td>
</tr>
<tr>
<td align="left">&quot;qwer&quot;</td>
<td align="left">&quot;we</td>
</tr>
</tbody></table>
<hr>
<p>💡<strong>풀이</strong></p>
<pre><code>class Solution {
    public String solution(String s) {
        String[] arr = s.split(&quot;&quot;);
        return arr.length % 2 == 0 ? arr[arr.length / 2 - 1] + arr[arr.length / 2] : arr[arr.length / 2];
    }
}</code></pre>]]></description>
        </item>
        <item>
            <title><![CDATA[[Lv.1] 같은 숫자는 싫어(Java)]]></title>
            <link>https://velog.io/@wo_he98/Lv.1-%EA%B0%99%EC%9D%80-%EC%88%AB%EC%9E%90%EB%8A%94-%EC%8B%AB%EC%96%B4Java</link>
            <guid>https://velog.io/@wo_he98/Lv.1-%EA%B0%99%EC%9D%80-%EC%88%AB%EC%9E%90%EB%8A%94-%EC%8B%AB%EC%96%B4Java</guid>
            <pubDate>Wed, 14 Dec 2022 13:00:18 GMT</pubDate>
            <description><![CDATA[<p><strong>문제</strong></p>
<blockquote>
<p>배열 arr가 주어집니다. 배열 arr의 각 원소는 숫자 0부터 9까지로 이루어져 있습니다. 이때, 배열 arr에서 연속적으로 나타나는 숫자는 하나만 남기고 전부 제거하려고 합니다. 단, 제거된 후 남은 수들을 반환할 때는 배열 arr의 원소들의 순서를 유지해야 합니다. 예를 들면,</p>
</blockquote>
<ul>
<li>arr = [1, 1, 3, 3, 0, 1, 1] 이면 [1, 3, 0, 1] 을 return 합니다.</li>
<li>arr = [4, 4, 4, 3, 3] 이면 [4, 3] 을 return 합니다.
배열 arr에서 연속적으로 나타나는 숫자는 제거하고 남은 수들을 return 하는 solution 함수를 완성해 주세요.</li>
</ul>
<p><strong>제한사항</strong></p>
<ul>
<li>배열 arr의 크기 : 1,000,000 이하의 자연수</li>
<li>배열 arr의 원소의 크기 : 0보다 크거나 같고 9보다 작거나 같은 정수</li>
</ul>
<p><strong>입출력 예</strong></p>
<table>
<thead>
<tr>
<th align="left">arr</th>
<th align="left">answer</th>
</tr>
</thead>
<tbody><tr>
<td align="left">[1,1,3,3,0,1,1]</td>
<td align="left">[1,3,0,1]</td>
</tr>
<tr>
<td align="left">[4,4,4,3,3]</td>
<td align="left">[4,3]</td>
</tr>
</tbody></table>
<p><strong>입출력 예 설명</strong></p>
<p>입출력 예 #1,2
문제의 예시와 같습니다.</p>
<hr>
<p>💡<strong>풀이</strong></p>
<pre><code>import java.util.*;

public class Solution {
    public int[] solution(int []arr) {
        ArrayList&lt;Integer&gt; list = new ArrayList&lt;&gt;();
        int n = -1;
        for(int i = 0; i &lt; arr.length; i++){
            if(n != arr[i]){
                list.add(arr[i]);
                n = arr[i];
            }
        }
        return list.stream().mapToInt(Integer::intValue).toArray();
    }
}</code></pre>]]></description>
        </item>
        <item>
            <title><![CDATA[[Lv.1] 나누어 떨어지는 숫자 배열(Java)]]></title>
            <link>https://velog.io/@wo_he98/Lv.1-%EB%82%98%EB%88%84%EC%96%B4-%EB%96%A8%EC%96%B4%EC%A7%80%EB%8A%94-%EC%88%AB%EC%9E%90-%EB%B0%B0%EC%97%B4Java</link>
            <guid>https://velog.io/@wo_he98/Lv.1-%EB%82%98%EB%88%84%EC%96%B4-%EB%96%A8%EC%96%B4%EC%A7%80%EB%8A%94-%EC%88%AB%EC%9E%90-%EB%B0%B0%EC%97%B4Java</guid>
            <pubDate>Wed, 14 Dec 2022 12:58:35 GMT</pubDate>
            <description><![CDATA[<p><strong>문제</strong></p>
<blockquote>
<p>array의 각 element 중 divisor로 나누어 떨어지는 값을 오름차순으로 정렬한 배열을 반환하는 함수, solution을 작성해주세요.
divisor로 나누어 떨어지는 element가 하나도 없다면 배열에 -1을 담아 반환하세요.</p>
</blockquote>
<p><strong>제한사항</strong></p>
<ul>
<li>arr은 자연수를 담은 배열입니다.</li>
<li>정수 i, j에 대해 i ≠ j 이면 arr[i] ≠ arr[j] 입니다.</li>
<li>divisor는 자연수입니다.</li>
<li>array는 길이 1 이상인 배열입니다.</li>
</ul>
<p><strong>입출력 예</strong></p>
<table>
<thead>
<tr>
<th align="left">arr</th>
<th align="left">divisior</th>
<th align="left">return</th>
</tr>
</thead>
<tbody><tr>
<td align="left">[5, 9, 7, 10]</td>
<td align="left">5</td>
<td align="left">[5, 10]</td>
</tr>
<tr>
<td align="left">[2, 36, 1, 3]</td>
<td align="left">1</td>
<td align="left">[1, 2, 3, 36]</td>
</tr>
<tr>
<td align="left">[3,2,6]</td>
<td align="left">10</td>
<td align="left">[-1]</td>
</tr>
</tbody></table>
<p><strong>입출력 예 설명</strong></p>
<p>입출력 예#1
arr의 원소 중 5로 나누어 떨어지는 원소는 5와 10입니다. 따라서 [5, 10]을 리턴합니다.</p>
<p>입출력 예#2
arr의 모든 원소는 1으로 나누어 떨어집니다. 원소를 오름차순으로 정렬해 [1, 2, 3, 36]을 리턴합니다.</p>
<p>입출력 예#3
3, 2, 6은 10으로 나누어 떨어지지 않습니다. 나누어 떨어지는 원소가 없으므로 [-1]을 리턴합니다.</p>
<hr>
<p>💡<strong>풀이</strong></p>
<pre><code>import java.util.*;

class Solution {
    public int[] solution(int[] arr, int divisor) {
        ArrayList&lt;Integer&gt; list = new ArrayList&lt;&gt;();
        for(int i = 0; i &lt; arr.length; i++){
            if(arr[i] % divisor == 0){
                list.add(arr[i]);
            }
        }

        if(list.size() == 0){
            list.add(-1);
        }

        Collections.sort(list);

        return list.stream().mapToInt(Integer::intValue).toArray();
    }
}</code></pre>]]></description>
        </item>
        <item>
            <title><![CDATA[[Lv.1] 두 정수 사이의 합(Java)]]></title>
            <link>https://velog.io/@wo_he98/Lv.1-%EB%91%90-%EC%A0%95%EC%88%98-%EC%82%AC%EC%9D%B4%EC%9D%98-%ED%95%A9Java</link>
            <guid>https://velog.io/@wo_he98/Lv.1-%EB%91%90-%EC%A0%95%EC%88%98-%EC%82%AC%EC%9D%B4%EC%9D%98-%ED%95%A9Java</guid>
            <pubDate>Wed, 14 Dec 2022 12:56:29 GMT</pubDate>
            <description><![CDATA[<p><strong>문제</strong></p>
<blockquote>
<p>두 정수 a, b가 주어졌을 때 a와 b 사이에 속한 모든 정수의 합을 리턴하는 함수, solution을 완성하세요.
예를 들어 a = 3, b = 5인 경우, 3 + 4 + 5 = 12이므로 12를 리턴합니다.</p>
</blockquote>
<p><strong>제한사항</strong></p>
<ul>
<li>a와 b가 같은 경우는 둘 중 아무 수나 리턴하세요.</li>
<li>a와 b는 -10,000,000 이상 10,000,000 이하인 정수입니다.</li>
<li>a와 b의 대소관계는 정해져있지 않습니다.</li>
</ul>
<p><strong>입출력 예</strong></p>
<table>
<thead>
<tr>
<th align="left">a</th>
<th align="left">b</th>
<th align="left">return</th>
</tr>
</thead>
<tbody><tr>
<td align="left">3</td>
<td align="left">5</td>
<td align="left">12</td>
</tr>
<tr>
<td align="left">3</td>
<td align="left">3</td>
<td align="left">3</td>
</tr>
<tr>
<td align="left">5</td>
<td align="left">3</td>
<td align="left">12</td>
</tr>
</tbody></table>
<hr>
<p>💡<strong>풀이</strong></p>
<pre><code>class Solution {
    public long solution(int a, int b) {
        long answer = 0;

        for(int i = Math.min(a,b); i &lt;= Math.max(a,b); i++){
            answer += (long)i;
        }
        return answer;
    }
}</code></pre>]]></description>
        </item>
        <item>
            <title><![CDATA[[Lv.1] 문자열 내 마음대로 정렬하기(Java)]]></title>
            <link>https://velog.io/@wo_he98/Lv.1-%EB%AC%B8%EC%9E%90%EC%97%B4-%EB%82%B4-%EB%A7%88%EC%9D%8C%EB%8C%80%EB%A1%9C-%EC%A0%95%EB%A0%AC%ED%95%98%EA%B8%B0Java</link>
            <guid>https://velog.io/@wo_he98/Lv.1-%EB%AC%B8%EC%9E%90%EC%97%B4-%EB%82%B4-%EB%A7%88%EC%9D%8C%EB%8C%80%EB%A1%9C-%EC%A0%95%EB%A0%AC%ED%95%98%EA%B8%B0Java</guid>
            <pubDate>Wed, 14 Dec 2022 12:55:06 GMT</pubDate>
            <description><![CDATA[<p><strong>문제</strong></p>
<blockquote>
<p>문자열로 구성된 리스트 strings와, 정수 n이 주어졌을 때, 각 문자열의 인덱스 n번째 글자를 기준으로 오름차순 정렬하려 합니다. 예를 들어 strings가 [&quot;sun&quot;, &quot;bed&quot;, &quot;car&quot;]이고 n이 1이면 각 단어의 인덱스 1의 문자 &quot;u&quot;, &quot;e&quot;, &quot;a&quot;로 strings를 정렬합니다.</p>
</blockquote>
<p><strong>제한사항</strong></p>
<ul>
<li>strings는 길이 1 이상, 50이하인 배열입니다.</li>
<li>strings의 원소는 소문자 알파벳으로 이루어져 있습니다.</li>
<li>strings의 원소는 길이 1 이상, 100이하인 문자열입니다.</li>
<li>모든 strings의 원소의 길이는 n보다 큽니다.</li>
<li>인덱스 1의 문자가 같은 문자열이 여럿 일 경우, 사전순으로 앞선 문자열이 앞쪽에 위치합니다.</li>
</ul>
<p><strong>입출력 예</strong></p>
<table>
<thead>
<tr>
<th align="left">strings</th>
<th align="left">n</th>
<th align="left">return</th>
</tr>
</thead>
<tbody><tr>
<td align="left">[&quot;sun&quot;, &quot;bed&quot;, &quot;car&quot;]</td>
<td align="left">1</td>
<td align="left">[&quot;car&quot;, &quot;bed&quot;, &quot;sun&quot;]</td>
</tr>
<tr>
<td align="left">[&quot;abce&quot;, &quot;abcd&quot;, &quot;cdx&quot;]</td>
<td align="left">2</td>
<td align="left">[&quot;abcd&quot;, &quot;abce&quot;, &quot;cdx&quot;]</td>
</tr>
</tbody></table>
<p><strong>입출력 예 설명</strong></p>
<p>입출력 예 1
&quot;sun&quot;, &quot;bed&quot;, &quot;car&quot;의 1번째 인덱스 값은 각각 &quot;u&quot;, &quot;e&quot;, &quot;a&quot; 입니다. 이를 기준으로 strings를 정렬하면 [&quot;car&quot;, &quot;bed&quot;, &quot;sun&quot;] 입니다.</p>
<p>입출력 예 2
&quot;abce&quot;와 &quot;abcd&quot;, &quot;cdx&quot;의 2번째 인덱스 값은 &quot;c&quot;, &quot;c&quot;, &quot;x&quot;입니다. 따라서 정렬 후에는 &quot;cdx&quot;가 가장 뒤에 위치합니다. &quot;abce&quot;와 &quot;abcd&quot;는 사전순으로 정렬하면 &quot;abcd&quot;가 우선하므로, 답은 [&quot;abcd&quot;, &quot;abce&quot;, &quot;cdx&quot;] 입니다.</p>
<hr>
<p>💡<strong>풀이</strong></p>
<pre><code>import java.util.*;

class Solution {
    public String[] solution(String[] strings, int n) {
        String[] answer = new String[strings.length];

        ArrayList&lt;String&gt; list = new ArrayList&lt;&gt;();

        for(int i = 0; i &lt; strings.length; i++){
            list.add(strings[i].charAt(n) + strings[i]);
        }

        Collections.sort(list);

        for(int i = 0; i &lt; list.size(); i++) {
            answer[i] = list.get(i).substring(1);
        }
        return answer;
    }
}</code></pre>]]></description>
        </item>
        <item>
            <title><![CDATA[[Lv.1] 문자열 내 p와 y의 개수(Java)]]></title>
            <link>https://velog.io/@wo_he98/Lv.1-%EB%AC%B8%EC%9E%90%EC%97%B4-%EB%82%B4-p%EC%99%80-y%EC%9D%98-%EA%B0%9C%EC%88%98Java</link>
            <guid>https://velog.io/@wo_he98/Lv.1-%EB%AC%B8%EC%9E%90%EC%97%B4-%EB%82%B4-p%EC%99%80-y%EC%9D%98-%EA%B0%9C%EC%88%98Java</guid>
            <pubDate>Wed, 14 Dec 2022 05:45:15 GMT</pubDate>
            <description><![CDATA[<p><strong>문제</strong></p>
<blockquote>
<p>대문자와 소문자가 섞여있는 문자열 s가 주어집니다. s에 &#39;p&#39;의 개수와 &#39;y&#39;의 개수를 비교해 같으면 True, 다르면 False를 return 하는 solution를 완성하세요. &#39;p&#39;, &#39;y&#39; 모두 하나도 없는 경우는 항상 True를 리턴합니다. 단, 개수를 비교할 때 대문자와 소문자는 구별하지 않습니다.
예를 들어 s가 &quot;pPoooyY&quot;면 true를 return하고 &quot;Pyy&quot;라면 false를 return합니다.</p>
</blockquote>
<p><strong>제한사항</strong></p>
<ul>
<li>문자열 s의 길이 : 50 이하의 자연수</li>
<li>문자열 s는 알파벳으로만 이루어져 있습니다.</li>
</ul>
<p><strong>입출력 예</strong></p>
<table>
<thead>
<tr>
<th align="left">s</th>
<th align="left">answer</th>
</tr>
</thead>
<tbody><tr>
<td align="left">&quot;pPoooyY&quot;</td>
<td align="left">true</td>
</tr>
<tr>
<td align="left">&quot;Pyy&quot;</td>
<td align="left">false</td>
</tr>
</tbody></table>
<hr>
<p>💡<strong>풀이</strong></p>
<pre><code>class Solution {
    boolean solution(String s) {
        int pCount = 0;
        int yCount = 0;

        String[] arr = s.toLowerCase().split(&quot;&quot;);
        for(int i = 0; i &lt; arr.length; i++){
            if(arr[i].equals(&quot;p&quot;)){
                pCount++;
            }else if(arr[i].equals(&quot;y&quot;)){
                yCount++;
            }
        }
        return pCount == yCount ? true : false;
    }
}</code></pre>]]></description>
        </item>
        <item>
            <title><![CDATA[[Lv.1] 문자열 내림차순으로 배치하기(Java)]]></title>
            <link>https://velog.io/@wo_he98/Lv.1-%EB%AC%B8%EC%9E%90%EC%97%B4-%EB%82%B4%EB%A6%BC%EC%B0%A8%EC%88%9C%EC%9C%BC%EB%A1%9C-%EB%B0%B0%EC%B9%98%ED%95%98%EA%B8%B0Java</link>
            <guid>https://velog.io/@wo_he98/Lv.1-%EB%AC%B8%EC%9E%90%EC%97%B4-%EB%82%B4%EB%A6%BC%EC%B0%A8%EC%88%9C%EC%9C%BC%EB%A1%9C-%EB%B0%B0%EC%B9%98%ED%95%98%EA%B8%B0Java</guid>
            <pubDate>Wed, 14 Dec 2022 05:43:43 GMT</pubDate>
            <description><![CDATA[<p><strong>문제</strong></p>
<blockquote>
<p>문자열 s에 나타나는 문자를 큰것부터 작은 순으로 정렬해 새로운 문자열을 리턴하는 함수, solution을 완성해주세요.
s는 영문 대소문자로만 구성되어 있으며, 대문자는 소문자보다 작은 것으로 간주합니다.</p>
</blockquote>
<p><strong>제한사항</strong></p>
<ul>
<li>str은 길이 1 이상인 문자열입니다.</li>
</ul>
<p><strong>입출력 예</strong></p>
<table>
<thead>
<tr>
<th align="left">s</th>
<th align="left">return</th>
</tr>
</thead>
<tbody><tr>
<td align="left">&quot;Zbcdefg&quot;</td>
<td align="left">&quot;gfedcbZ&quot;</td>
</tr>
</tbody></table>
<hr>
<p>💡<strong>풀이</strong></p>
<pre><code>import java.util.*;

class Solution {
    public String solution(String s) {
        String answer = &quot;&quot;;
        char[] arr = s.toCharArray();
        Arrays.sort(arr);

        for(int i = arr.length - 1; i &gt;= 0; i--){
            answer += arr[i];
        }
        return answer;
    }
}</code></pre>]]></description>
        </item>
        <item>
            <title><![CDATA[[Lv.1] 문자열 다루기 기본(Java)]]></title>
            <link>https://velog.io/@wo_he98/Lv.1-%EB%AC%B8%EC%9E%90%EC%97%B4-%EB%8B%A4%EB%A3%A8%EA%B8%B0-%EA%B8%B0%EB%B3%B8Java</link>
            <guid>https://velog.io/@wo_he98/Lv.1-%EB%AC%B8%EC%9E%90%EC%97%B4-%EB%8B%A4%EB%A3%A8%EA%B8%B0-%EA%B8%B0%EB%B3%B8Java</guid>
            <pubDate>Wed, 14 Dec 2022 05:42:13 GMT</pubDate>
            <description><![CDATA[<p><strong>문제</strong></p>
<blockquote>
<p>문자열 s의 길이가 4 혹은 6이고, 숫자로만 구성돼있는지 확인해주는 함수, solution을 완성하세요. 예를 들어 s가 &quot;a234&quot;이면 False를 리턴하고 &quot;1234&quot;라면 True를 리턴하면 됩니다.</p>
</blockquote>
<p><strong>제한사항</strong></p>
<ul>
<li>s는 길이 1 이상, 길이 8 이하인 문자열입니다.</li>
<li>s는 영문 알파벳 대소문자 또는 0부터 9까지 숫자로 이루어져 있습니다.</li>
</ul>
<p><strong>입출력 예</strong></p>
<table>
<thead>
<tr>
<th align="left">s</th>
<th align="left">return</th>
</tr>
</thead>
<tbody><tr>
<td align="left">&quot;a234&quot;</td>
<td align="left">false</td>
</tr>
<tr>
<td align="left">&quot;1234&quot;</td>
<td align="left">true</td>
</tr>
</tbody></table>
<hr>
<p>💡<strong>풀이</strong></p>
<pre><code>class Solution {
    public boolean solution(String s) {
        if (s.length() == 4 || s.length() == 6){
            if(s.matches(&quot;(^[0-9]*$)&quot;)){
                return true;
            }  
        } 
        return false;
    }
}</code></pre>]]></description>
        </item>
        <item>
            <title><![CDATA[[Lv.1] 서울에서 김서방 찾기(Java)]]></title>
            <link>https://velog.io/@wo_he98/Lv.1-%EC%84%9C%EC%9A%B8%EC%97%90%EC%84%9C-%EA%B9%80%EC%84%9C%EB%B0%A9-%EC%B0%BE%EA%B8%B0Java</link>
            <guid>https://velog.io/@wo_he98/Lv.1-%EC%84%9C%EC%9A%B8%EC%97%90%EC%84%9C-%EA%B9%80%EC%84%9C%EB%B0%A9-%EC%B0%BE%EA%B8%B0Java</guid>
            <pubDate>Wed, 14 Dec 2022 05:40:45 GMT</pubDate>
            <description><![CDATA[<p><strong>문제</strong></p>
<blockquote>
<p>String형 배열 seoul의 element중 &quot;Kim&quot;의 위치 x를 찾아, &quot;김서방은 x에 있다&quot;는 String을 반환하는 함수, solution을 완성하세요. seoul에 &quot;Kim&quot;은 오직 한 번만 나타나며 잘못된 값이 입력되는 경우는 없습니다.</p>
</blockquote>
<p><strong>제한사항</strong></p>
<ul>
<li>seoul은 길이 1 이상, 1000 이하인 배열입니다.</li>
<li>seoul의 원소는 길이 1 이상, 20 이하인 문자열입니다.</li>
<li>&quot;Kim&quot;은 반드시 seoul 안에 포함되어 있습니다.</li>
</ul>
<p><strong>입출력 예</strong></p>
<table>
<thead>
<tr>
<th align="left">seoul</th>
<th align="left">return</th>
</tr>
</thead>
<tbody><tr>
<td align="left">[&quot;Jane&quot;, &quot;Kim&quot;]</td>
<td align="left">&quot;김서방은 1에 있다&quot;</td>
</tr>
</tbody></table>
<hr>
<p>💡<strong>풀이</strong></p>
<pre><code>class Solution {
    public String solution(String[] seoul) {
        int count = 0;
        for(int i = 0; i &lt; seoul.length; i++){
            if(seoul[i].equals(&quot;Kim&quot;)){
                count += i;
                break;
            }
        }
        return &quot;김서방은 &quot; + count + &quot;에 있다&quot;;
    }
}</code></pre>]]></description>
        </item>
        <item>
            <title><![CDATA[[Lv.1] 소수 찾기(Java)]]></title>
            <link>https://velog.io/@wo_he98/Lv.1-%EC%86%8C%EC%88%98-%EC%B0%BE%EA%B8%B0Java</link>
            <guid>https://velog.io/@wo_he98/Lv.1-%EC%86%8C%EC%88%98-%EC%B0%BE%EA%B8%B0Java</guid>
            <pubDate>Wed, 14 Dec 2022 05:39:11 GMT</pubDate>
            <description><![CDATA[<p><strong>문제</strong></p>
<blockquote>
<p>1부터 입력받은 숫자 n 사이에 있는 소수의 개수를 반환하는 함수, solution을 만들어 보세요. 소수는 1과 자기 자신으로만 나누어지는 수를 의미합니다.(1은 소수가 아닙니다.)</p>
</blockquote>
<p><strong>제한사항</strong></p>
<ul>
<li>n은 2이상 1000000이하의 자연수입니다.</li>
</ul>
<p><strong>입출력 예</strong></p>
<table>
<thead>
<tr>
<th align="left">n</th>
<th align="left">result</th>
</tr>
</thead>
<tbody><tr>
<td align="left">10</td>
<td align="left">4</td>
</tr>
<tr>
<td align="left">5</td>
<td align="left">3</td>
</tr>
</tbody></table>
<p><strong>입출력 예 설명</strong></p>
<p>입출력 예 #1
1부터 10 사이의 소수는 [2,3,5,7] 4개가 존재하므로 4를 반환</p>
<p>입출력 예 #2
1부터 5 사이의 소수는 [2,3,5] 3개가 존재하므로 3를 반환</p>
<hr>
<p>💡<strong>풀이</strong></p>
<pre><code>class Solution {
    public int solution(int n) {
        int answer = 0;

        int[] numbers = new int[n+1];

        for(int i = 2; i &lt;= n; i++) numbers[i]=i;

        for(int i = 2; i &lt; n; i++) {
            if(numbers[i] == 0) continue;
            for(int j = 2 * i; j &lt;= n; j += i) numbers[j] = 0;
        }

        for(int i = 0; i &lt; numbers.length; i++) {
            if(numbers[i] != 0) answer++;
        }

        return answer;
    }
}</code></pre>]]></description>
        </item>
        <item>
            <title><![CDATA[[Lv.1] 수박수박수박수박수박수?(Java)]]></title>
            <link>https://velog.io/@wo_he98/Lv.1-%EC%88%98%EB%B0%95%EC%88%98%EB%B0%95%EC%88%98%EB%B0%95%EC%88%98%EB%B0%95%EC%88%98%EB%B0%95%EC%88%98Java</link>
            <guid>https://velog.io/@wo_he98/Lv.1-%EC%88%98%EB%B0%95%EC%88%98%EB%B0%95%EC%88%98%EB%B0%95%EC%88%98%EB%B0%95%EC%88%98%EB%B0%95%EC%88%98Java</guid>
            <pubDate>Wed, 14 Dec 2022 05:37:28 GMT</pubDate>
            <description><![CDATA[<p><strong>문제</strong></p>
<blockquote>
<p>길이가 n이고, &quot;수박수박수박수....&quot;와 같은 패턴을 유지하는 문자열을 리턴하는 함수, solution을 완성하세요. 예를들어 n이 4이면 &quot;수박수박&quot;을 리턴하고 3이라면 &quot;수박수&quot;를 리턴하면 됩니다.</p>
</blockquote>
<p><strong>제한사항</strong></p>
<ul>
<li>n은 길이 10,000이하인 자연수입니다.</li>
</ul>
<p><strong>입출력 예</strong></p>
<table>
<thead>
<tr>
<th align="left">n</th>
<th align="left">return</th>
</tr>
</thead>
<tbody><tr>
<td align="left">3</td>
<td align="left">&quot;수박수&quot;</td>
</tr>
<tr>
<td align="left">4</td>
<td align="left">&quot;수박수박&quot;</td>
</tr>
</tbody></table>
<hr>
<p>💡<strong>풀이</strong></p>
<pre><code>class Solution {
    public String solution(int n) {
        String answer = &quot;&quot;;
        for(int i = 1; i &lt;= n; i++){
            if(i % 2 != 0){
                answer += &quot;수&quot;;
            }else{
                answer += &quot;박&quot;;
            }
        }
        return answer;
    }
}</code></pre>]]></description>
        </item>
    </channel>
</rss>