new_algos's blog

By new_algos, history, 5 years ago, In English

You are given an array of n integers. Your task is to calculate the median of each window of k elements, from left to right.

The median is the middle element when the elements are sorted. If the number of elements is even, there are two possible medians and we assume that the median is the smaller of them.

1≤k≤n≤2⋅105

1≤xi≤109

Full text and comments »

  • Vote: I like it
  • +13
  • Vote: I do not like it