Day - 40
Assalamu alaykum, everyone! How are you dears?
Today is the 40th day of my challenge. We have spent almost half of the allotted time. These days were full of many interesting events. There were different situations. In any situation, I tried not to lose consistency and move forward. Even if I get sick.
But I only benefited from this. Because these days I have developed the skills to do something regularly. After the 100-day challenge is over, I plan to do a few more challenges. They can also be longer than programming. Because our life is not only made up of our profession!
But while we're on the subject of programming, let's talk about this. Let's start coding!
/*
* @param {number[]} score
* @return {string[]}
*/
var findRelativeRanks = function (score) {
let newScore = [...score].sort((a, b) => b - a),
mapRes = new Map(),
len = score.length,
scoreIndex = 0;
for (let i = 0; i < newScore.length; i++) {
mapRes.set(newScore[i], i);
}
while (scoreIndex < len) {
score[scoreIndex] = "" + (mapRes.get(score[scoreIndex]) + 1);
if (score[scoreIndex] === "1") score[scoreIndex] = "Gold Medal";
if (score[scoreIndex] === "2") score[scoreIndex] = "Silver Medal";
if (score[scoreIndex] === "3") score[scoreIndex] = "Bronze Medal";
scoreIndex++;
}
return score;
};
Thanks for your attention dears! That's all I am going to share with you! Take care! See you!