nums.start to 0 and max_beauty to 0.end pointer.end pointer position, check if the difference between nums[end] and nums[start] is greater than 2k.start pointer forward until the difference is less than or equal to 2k.max_beauty to be the maximum of its current value and the window size end - start + 1.max_beauty as the result.