[알고리즘] - 순위 알고리즘 (Rank algorithm)
순위 알고리즘 : 주어진 데이터의 순위를 구하는 로직 //[?] 주어진(지정한 범위) 데이터의 순위(등수)를 구하는 로직 // 순위 알고리즘 (RANK) : 함수 데이터에 대한 순위 구하기 const scores = [90, 87, 100, 95, 80]; // 등수 : 3,4,1,2,5 let ranker = Array(scores.length).fill(1); // 배열의 점수별로 등수 매기기 scores.forEach((e, i) => { ranker.forEach((f, j) => { if (e { console.log(`점수 : ${e.toString().padStart(3)} , 순..
2022. 1. 14.