Created
July 16, 2016 15:01
-
-
Save ilpropheta/393d4a40d256048b556fd70bef9c9654 to your computer and use it in GitHub Desktop.
This file contains 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
const auto lb = lower_bound(begin(sortedVec), end(sortedVec), P); | |
const auto ub = std::upper_bound(lb, end(sortedVec), P, [](const string& s1, const string& s2){ | |
return s2.compare(0, s1.size(), s1); // s1 is P | |
}); | |
cout << distance(lb, ub); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment