You are given a program that allocates a dynamic buffer inside a limited scope.
Your task is to manage this buffer using std::unique_ptr so that the memory is released automatically when the scope ends, without calling delete.
std::unique_ptr
delete
This problem introduces the core idea of RAII (Resource Acquisition Is Initialization), where resource lifetime is tied to object lifetime.
Program Flow:
N
Example Input:
4 10 20 30 40
Example Output:
10 20 30 40 Scope ended
Constraints:
Test Cases
Test Results
Input
1 0
Expected Output
0 Scope ended