We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
You could have a vector to store indices that have same costs.
unordered_map<int,vector<int>> h;
for(int i=0;i<cost.size();i++){
h[cost[i]].push_back(i+1);
}
Hash Tables: Ice Cream Parlor
You are viewing a single comment's thread. Return to all comments →