You are viewing a single comment's thread. Return to all comments →
Satisfies "If two fans get the burger at the same time, then print the smallest numbered order first" without any extra condition.
vector<int> jimOrders(vector<vector<int>> orders) { int n=orders.size(); vector<pair<int,int>> sum(n); for(int i=0;i<n;i++) { sum[i].first=orders[i][0]+orders[i][1]; sum[i].second=i+1; } sort(sum.begin(), sum.end()); vector<int> index(n); for(int i=0;i<n;i++) { index[i]=sum[i].second; } return index; }
Seems like cookies are disabled on this browser, please enable them to open this website
Jim and the Orders
You are viewing a single comment's thread. Return to all comments →
Satisfies "If two fans get the burger at the same time, then print the smallest numbered order first" without any extra condition.