Gidhub BE Developer

Vector :: STL Function

2017-10-08
goodGid

Code

  1. Find min Value in Vector
  2. Delete min Value in Vector

vector<int> solution(vector<int> arr) {
    int nMin = *min_element(arr.begin(), arr.end());
    int pos = find(arr.begin(), arr.end(), nMin) - arr.begin();
    arr.erase(arr.begin() + pos);
    return arr;
}



Comments

Content