[HackerRank]CountingSort1

jh Seo·2024년 2월 4일
0

HackerRank

목록 보기
7/15

개요

[HackerRank]CountingSort1

접근 방식

설명은 quicksort부터 뭐 성능이 좋지만 어쩌구 하지만
결국 요약하면 counting sort구현하라는 얘기이다.

전체 코드

/*
 * Complete the 'countingSort' function below.
 *
 * The function is expected to return an INTEGER_ARRAY.
 * The function accepts INTEGER_ARRAY arr as parameter.
 */

vector<int> countingSort(vector<int> arr) {
    vector<int> counting(100);
    for(int elem : arr){
        counting[elem]++;
    }
    return counting;
}
profile
코딩 창고!

0개의 댓글