For this lesson, whys is the complexity O(n^3)? I understand that sliding window takes O(n) and we have another for loop nested that creates the subarrays. Therefore, shouldn’t total runtime be O(n^2)? The lesson doesn’t explain clearly why O(n^3).

Type your question above this line.

Course: https://www.educative.io/collection/5668639101419520/5671464854355968

Lesson: https://www.educative.io/collection/page/5668639101419520/5671464854355968/5902703286812672