Available question text
Given a binary array and an integer k, find the minimum number of adjacent swaps needed to make k ones consecutive by choosing which k ones to gather and minimizing the total distance they must move; this reduces to selecting k one-positions whose distances to their median are minimal and can be computed efficiently using the indices of ones (sliding window + prefix sums).
Related questions
Continue with questions that share topics or the same question type.
Sources · 1 reference
These records explain where the question appears. A company tag or candidate report does not guarantee a future interview question.
Hello Interview · 1 record
No company association
Leetcode 1703. Minimum Adjacent Swaps for K Consecutive Ones
Reported date not specified · 0 source reports
Source snapshot: Nov 12, 2026
View source