Given scores of N athletes, find their relative ranks and the people with the top three highest scores, who will be awarded medals: “Gold Medal”, “Silver Medal” and “Bronze Medal”.
var findRelativeRanks = function(nums) {
var res = [];
var tmp = [];
var obj = {};
tmp = nums.slice();
tmp.sort(function(a,b) {return b - a})
obj[tmp[]] = 'Gold Medal';
obj[tmp[]] = 'Silver Medal';
obj[tmp[]] = 'Bronze Medal';
for(var m = ; m < tmp.length; m++) {
obj[tmp[m]] = m + + ''
}
for(var j = ; j < nums.length; j++) {
res.push(obj[nums[j]])
}
return res
};