What is the time complexity of a C++ program with a nested for-loop?
What is the time complexity of a C++ program with a nested for-loop?
Explanation
In a nested for-loop, the inner loop executes N times for each iteration of the outer loop.
This results in a total of N × N = N² iterations, making the time complexity O(N²).