Created
August 31, 2022 20:14
-
-
Save piusayowale/c0d853dcd3d6861be08b5c0e7bf7e533 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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