2:39 - you say it's O(n^2) without explaining 'why' it's O(n^2). Perhaps it's obvious to you, but for an audience who came here to learn this, it isn't. Looking at that code, I'm not seeing a nested loop - rather I'm seeing one loop, implying to me the runtime would be O(n).
@algo.monster Жыл бұрын
thanks for the comment! there is a nested loop, the outer one is "for i in range(1, n+1)" and the inner one is "for i in banned"?
@yanikjayaram Жыл бұрын
@@algo.monster ah got it thanks! do you tutor by chance?