国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 學院 > 開發設計 > 正文

LeetCode 506. Relative Ranks

2019-11-06 06:13:58
字體:
來源:轉載
供稿:網友

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”. Example 1: Input: [5, 4, 3, 2, 1] Output: [“Gold Medal”, “Silver Medal”, “Bronze Medal”, “4”, “5”] Explanation: The first three athletes got the top three highest scores, so they got “Gold Medal”, “Silver Medal” and “Bronze Medal”. For the left two athletes, you just need to output their relative ranks according to their scores. Note: N is a positive integer and won’t exceed 10,000. All the scores of athletes are guaranteed to be unique. Subscribe to see which companies asked this question.

這個題目看起來挺簡單的,但一不小心就會掉坑里去。下面是樓主自己寫的,作為一個leetcode新手,希望大家多多指教。 class Solution { public: vector findRelativeRanks(vector& nums) { vector result(nums.size()); int n = nums.size(); const string s1 = “Gold Medal”; const string s2 = “Silver Medal”; const string s3 = “Bronze Medal”; int *hash_table = new int[65535000]; for(int i = 0; i


發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 商洛市| 平江县| 遵义市| 台南县| 钟祥市| 同江市| 漳州市| 股票| 苍溪县| 巴彦淖尔市| 隆化县| 甘谷县| 金华市| 名山县| 昌江| 闽清县| 延津县| 广丰县| 雷州市| 忻城县| 化州市| 蛟河市| 巫山县| 赣州市| 福泉市| 望奎县| 兴仁县| 霍邱县| 土默特左旗| 平陆县| 永平县| 安庆市| 拉萨市| 万州区| 宜兰市| 花莲市| 商水县| 北票市| 祁连县| 江门市| 吴桥县|