Implement a class to manage a simple integer array with methods to add an element and get the maximum value.
HardProblem Statement
Implement a class to manage a simple integer array with methods to add an element and get the maximum value.
Sample Input
ArrayManager arr; arr.add(5); arr.add(10); arr.add(3);
Sample Output
Maximum value: 10
Limits
Time: 2s · Memory: 256 MB
Code Editor
00:00
#include <iostream>
#include <vector>
class ArrayManager {
private:
std::vector<int> elements;
public:
void add(int value);
int getMax();
};
int main() {
// Logic to demonstrate ArrayManager functionality
return 0;
}
Input
ArrayManager arr; arr.add(5); arr.add(10); arr.add(3);
Expected Output
Maximum value: 10