Skip to content

Instantly share code, notes, and snippets.

@hikilaka
Created March 9, 2017 02:15
Show Gist options
  • Save hikilaka/24e85871c853519f2e9094526342d1e3 to your computer and use it in GitHub Desktop.
Save hikilaka/24e85871c853519f2e9094526342d1e3 to your computer and use it in GitHub Desktop.
template <typename T>
struct less_than {
private:
const T a;
public:
less_than(const T a) : a(a) { }
bool operator()(const T &b) {
return b < a;
}
};
int summaryProficiency(std::vector<int> a, int n, int m) {
a.erase(std::remove_if(a.begin(), a.end(), less_than<int>(m)));
a.resize(n, 0);
return std::accumulate(a.begin(), a.end(), 0);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment