Grokking Data Structures & Algorithms for Coding Interviews
Ask Author
Back to course home

0% completed

Vote For New Content
Why not return [max(arr[i:i+k]) for i in range(len(arr)-k+1)]

kurtbell87

Mar 29, 2024

I understand the purpose of this module is using queues. What I don't understand is if this smaller more compact method is less efficient somehow

0

1

Comments
Comments
Ahmed Yarub Hani Al Nuaimi
Ahmed Yarub Hani Al Nuaimia year ago

The time complexity of your solution is O(n*k).

On this page