Yandex interview question

Find running median