solution to the running median