Kodewick
Start learning →
Starter←→0 / 60

High jump

#049StarterAlgorithms2 min

At sports day each high jump (in cm) goes into jumps; there is at least one. Write best_jump(jumps) and use max_element to find the highest.

Examples
best_jump({120, 135, 128})→135
best_jump({90})→90
The functionint best_jump(const vector<int> &jumps)
main.cpp
#include <algorithm>
#include <vector>
using namespace std;

int best_jump(const vector<int> &jumps) {
    // your code here: return the highest jump
    return jumps[0];
}
Ctrl + Enter runs too
Result

Run tries the examples. When they look right, Submit.