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.
vector<int>climbingLeaderboard(vector<int>ranked,vector<int>player){// Removing duplicatesautoend=unique(ranked.begin(),ranked.end());vector<int>out;// Checking lowerbound of elements of player in rankedfor(autoj:player){inti=distance(ranked.begin(),lower_bound(ranked.begin(),end,j,greater<int>()));out.push_back(i+1);}returnout;}
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Climbing the Leaderboard
You are viewing a single comment's thread. Return to all comments →
Simple solution using STL:lowerbound