Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

You have n super washing machines on a line. Initially, each washing machine has some dresses or is empty. For each move, you could choose

You have n super washing machines on a line. Initially, each washing machine has some dresses or is empty.
For each move, you could choose any m(1mn) washing machines, and pass one dress of each washing
machine to one of its adjacent washing machines at the same time.
Given an integer array representing the number of dresses in each washing machine from left to right
on the line, return the minimum number of moves to make all the washing machines have the same number of
dresses. If it is not possible to do it, return -1.
Example 1:
Example 2:
image text in transcribed

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions

Question

What does stickiest refer to in regard to social media

Answered: 1 week ago