hello_daddy's blog

By hello_daddy, 2 years ago, In English

We are given a stream of integers. We have to find median of the last K elements of the stream.

In other words

Constraints:
$$$0$$$ $$$\leq$$$ nums $$$\leq$$$ $$$10^6$$$, nums is the integer given in the stream.
K $$$\neq$$$ $$$0$$$ , atleast K elements have been given in the stream.
Refer to this comment for better understanding.

Full text and comments »

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