Kodewick
学びはじめる →
入門←→0 / 60

クラス写真

#047入門sort(begin, end)約 2 分

クラス写真のために、みんなが背の低い順に並びます。photo_line(heights) を書きましょう。<algorithm> の sort で身長を小さい順に並べ替えて返します。

例
photo_line({150, 138, 145})→[138, 145, 150]
photo_line({})→[]
関数vector<int> photo_line(vector<int> heights)
main.cpp
#include <algorithm>
#include <vector>
using namespace std;

vector<int> photo_line(vector<int> heights) {
    // ここにコードを書く:heights を並べ替える
    return heights;
}
Ctrl + Enter でも実行できます
結果

実行すると例で試せます。よさそうなら提出しましょう。