Deque problem ->maximum element in subarray using sliding window

what is time complexity of this problem

It is O(n) time complexity

.