Skip to content

Instantly share code, notes, and snippets.

@piusayowale
Created August 31, 2022 20:14
Show Gist options
  • Select an option

  • Save piusayowale/c0d853dcd3d6861be08b5c0e7bf7e533 to your computer and use it in GitHub Desktop.

Select an option

Save piusayowale/c0d853dcd3d6861be08b5c0e7bf7e533 to your computer and use it in GitHub Desktop.
vector<int> jimOrders(vector<vector<int>> orders) {
map<int, int> num;
vector<int> ret;
int index = 0;
for(auto d : orders){
int c = d[0] + d[1];
bool ch = true;
while (ch) {
if(num[c] != 0){
c++;
}else{
num[c] =index + 1;;
ch = false;
}
}
index++;
}
for(auto d : num){
ret.push_back(d.second);
}
return ret;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment