SnapLogic Pipeline executions may contain binary status markers, where 1 means a successful step and 0 means a recoverable failure. Given the markers and a replacement budget k, find the longest contiguous segment that can become all 1s by replacing at most k zeros.
Return the segment boundaries as [left, right]. If multiple segments have the same maximum length, return the one with the smallest left index. Indices are zero-based. If the input is empty, return [-1, -1].
Implement longest_ones_window(nums, k), where nums is a list of integers containing only 0 and 1, and k is a nonnegative integer. Return a two-element list [left, right] describing the selected inclusive window. The window must contain at most k zeros, and its length must be maximal.
def longest_ones_window(nums, k):