1. partition the array in blocks of size w=4. The last block may have less then w. 2. Traverse the list from start to end and calculate max_so_far. Reset max after each block boundary (of w elements).
* the iterating index is larger than k-2, SINCE we start at empty dequeu! ONE MORE THING: * we should check at first if the current maximum value is out of k-size window [i-k+1, i], ...
So, you’re looking to get better at those tricky LeetCode problems, especially the ones with stacks and queues? Good call! These data structures pop up all the time in coding interviews. It can feel a ...