You are viewing a single comment's thread. Return to all comments →
Easy cpp approach:-
vector jimOrders(vector> orders) {
int n=orders.size(); vector<int>dt(n,0); vector<int>cid(n,0); for (int i=0;i<n;i++) { dt[i]= orders[i][1]+orders[i][0]; cid[i]=i+1; } for (int i=0;i<n-1;i++) { for (int j=0;j<n-i-1;j++) { if (dt[j]>dt[j+1]) { swap(dt[j],dt[j+1]); swap(cid[j],cid[j+1]); } } } return cid;
}****
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 →
Easy cpp approach:-
vector jimOrders(vector> orders) {
}****