dq to store pairs of indices and their corresponding scores.score with the value of nums[0] since that's the starting point.nums starting from index 1.
i, first remove indices from the front of dq that are out of the current window (i.e., smaller than i-k).score to the sum of nums[i] and the score of the front element of dq.score, pop elements from the back of the deque.score as a pair to the back of the deque.score of the last element.