Practice Real Company Assessment Patterns • Latest 2025–2026 Mock Tests

Programming Exercises

Implement a class to manage a simple integer array with methods to add an element and get the maximum value.

Hard

Problem 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; }
Log in or sign up to run or submit your code.Log inSign up
Input
ArrayManager arr; arr.add(5); arr.add(10); arr.add(3);
Expected Output
Maximum value: 10