You are viewing a single comment's thread. Return to all comments →
Simple C++ Solution:
static bool cmp(const vector<long long>& vec1,const vector<long long>& vec2){ if(vec1[1] < vec2[1]){ return (vec1[1] < vec2[1]); }else { return (vec1[0] < vec2[0]) and (vec1[1] == vec2[1]); } } vector<int> jimOrders(vector<vector<int>>& orders) { int index = 1; vector<vector<long long>> vec; vector<int> res; for(auto& num:orders){ vector<long long> tmp; tmp.push_back(index); tmp.push_back(num[0]+num[1]); vec.push_back(tmp); index++; } sort(vec.begin(),vec.end(),cmp); for(auto& result:vec){ res.push_back(result[0]); } return res; }
Jim and the Orders
You are viewing a single comment's thread. Return to all comments →
Simple C++ Solution: