본문 바로가기

프로그래밍/기타

프로그래머스 - K번째수 (C#)

728x90
반응형
using System;
using System.Collections.Generic;

public class Solution
{
    public int[] solution(int[] array, int[,] commands)
    {
        int length = commands.GetLength(0);
        int[] answer = new int[length];
        List<int> sortingList = new List<int>();
        int index = 0;
        for(int i =0; i<length; ++i)
        {
            int start = commands[i,0] - 1;
            int end = commands[i,1] - 1;
            int line = commands[i,2] - 1;
            
            sortingList.Clear();
            for(int j=start; j<=end; ++j)
            {
                sortingList.Add(array[j]);
            }
            
            sortingList.Sort();
            answer[i] = sortingList[line];
        }
        
        return answer;
    }
}

다람쥐와 포동포동이

 

 

 

 

RememberCook 9월 28일 정식 출시!

두번째 게임인 RememberCook이 출시되었습니다. 귀여운 캐릭터들이 나오는 간단한 게임이며 플레이어의 공간인지능력을 테스트하는 게임입니다. 아래 링크를 통해 다운 받으실 수 있으니 많은 관

chipmunk-plump-plump.tistory.com

반응형

'프로그래밍 > 기타' 카테고리의 다른 글

프로그래머스 - H-Index (C#)  (0) 2021.01.15
프로그래머스 - 가장 큰 수 (c#)  (0) 2021.01.15
프로그래머스 - 베스트앨범 (C#)  (0) 2021.01.14
프로그래머스 - 위장 (C#)  (0) 2021.01.14
구글 스토어 앱 등록  (10) 2020.10.03