Your question is Estimating Algorithm Complexity. Start with the requirements on the right.
Run and submit as often as you like. When you're ready, talk me through your approach or go straight to the code.
Estimate the complexity of an algorithm.
Analyze an algorithm containing two independent loops, each iterating over an input of size n, and return its time and auxiliary space complexity. Implement estimate_complexity(n) to return [time_complexity, space_complexity] for this fixed algorithm pattern.
Use n >= 1; the output must be ["O(n^2)", "O(1)"].
def estimate_complexity(n):