Verisk interview question

sliding window question and a Joins Query.