๋ฌธ์ ๊ฐ ์ฝ๊ฐ ์ดํด๊ฐ ๋์ง ์๊ฒ ์ ํ์๋ค.
"์ด๋ค ๊ณผํ์๊ฐ ๋ฐํํ ๋
ผ๋ฌธ nํธ ์ค, h๋ฒ ์ด์ ์ธ์ฉ๋ ๋
ผ๋ฌธ์ด hํธ ์ด์์ด๊ณ ๋๋จธ์ง ๋
ผ๋ฌธ์ด h๋ฒ ์ดํ ์ธ์ฉ๋์๋ค๋ฉด h์ ์ต๋๊ฐ์ด ์ด ๊ณผํ์์ H-Index์
๋๋ค." ๋ผ๊ณ ํ๋๋ฐ
์ธ์ฉ๋ ๋
ผ๋ฌธ h์ h๋ฒ ์ด์ ์ธ์ฉ๋ ํ์๊ฐ ๊ฐ์์ผํ ๊ฒ ๊ฐ์๋ฐ (์ฆ, 3๋ฒ์ด์ ์ธ์ฉ๋ ๋
ผ๋ฌธ์ด 3๊ฐ์ด์์ด๊ฑฐ๋, 6๋ฒ์ด์ ์ธ์ฉ๋ ๋
ผ๋ฌธ์ด 6๊ฐ ์ด์์ผ๋ ๊ฐ์ ๊ฒฝ์ฐ)
์ ๋๋ก ๋ต์ ๊ตฌํ๊ธฐ ์ํด์ h๋ฒ์ด์ ์ธ์ฉ๋ ๋
ผ๋ฌธ์ ๊ฐฏ์๊ฐ ์ฃผ์ด์ง ๋ฐฐ์ด citations์ ์์(์ธ์ฉ๋ ํ์) ๋ณด๋ค ํด ๋๊ฐ H-Index ์ด๋ค.
function solution(citations) {
var answer = 0;
let resultPaperArr = []
citations.forEach((e) => {
let citedPaperCnt = 0;
for(let i = 0; i < citations.length; i++){
if(e <= citations[i]){
citedPaperCnt++
}
}
if(citedPaperCnt <= e){
resultPaperArr.push(citedPaperCnt);
}
})
answer = resultPaperArr.length > 0 ? Math.max(...resultPaperArr) : 0;
return answer;
}