쌓고 쌓다
[프로그래머스] H-Index C++ 풀이 본문
https://school.programmers.co.kr/learn/courses/30/lessons/42747#
프로그래머스
코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요.
programmers.co.kr
전체 코드
#include <string>
#include <vector>
#include <algorithm>
using namespace std;
int solution(vector<int> citations) {
int answer=0;
sort(citations.begin(),citations.end(),greater<>());
for(int i=0;i<citations.size();i++)
{
if(citations[i]>=i+1)
answer=i+1;
}
return answer;
}
H-Index의 값은 출판물의 개수만큼 갖는다.
인용 횟수를 내림차순으로 정렬하여
인용횟수가 Index보다 크거나 같은 마지막 위치가 H-Index이다.
여기에 설명이 잘되어있다.
https://en.wikipedia.org/wiki/H-index
h-index - Wikipedia
From Wikipedia, the free encyclopedia Jump to navigation Jump to search Metric that attempts to measure the productivity and citation impact of a person's publications The h-index is an author-level metric that measures both the productivity and citation i
en.wikipedia.org
'알고리즘 > 프로그래머스' 카테고리의 다른 글
[프로그래머스] 행렬의 곱셈 C++ 풀이 (1) | 2022.11.20 |
---|---|
[프로그래머스] 괄호 회전하기 C++ 풀이 (0) | 2022.11.19 |
[프로그래머스] 점프와 순간 이동 (0) | 2022.10.15 |
[프로그래머스] 멀리 뛰기 C++ 풀이 (0) | 2022.10.14 |
[프로그래머스] 예상 대진표 C++ 풀이 (0) | 2022.10.13 |
Comments