← ALL NOTES
Array

1769. Minimum Number of Operations to Move All Balls to Each Box

Binary string boxes, where boxes[i]='1' means box i holds a ball. One operation moves a ball to an adjacent box. For each box i, find the minimum total operations to gather ALL balls into it — i.e.…

Loading…