Skip to content

Commit 40d150b

Browse files
refactor 517
1 parent 28ec332 commit 40d150b

File tree

1 file changed

+0
-41
lines changed
  • src/main/java/com/fishercoder/solutions

1 file changed

+0
-41
lines changed

src/main/java/com/fishercoder/solutions/_517.java

Lines changed: 0 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -1,46 +1,5 @@
11
package com.fishercoder.solutions;
22

3-
/**
4-
* 517. Super Washing Machines
5-
*
6-
* You have n super washing machines on a line. Initially, each washing machine has some dresses or is empty.
7-
8-
For each move, you could choose any m (1 ? m ? n) washing machines, and pass one dress of each washing machine to one of its adjacent washing machines at the same time .
9-
10-
Given an integer array representing the number of dresses in each washing machine from left to right on the line, you should find 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.
11-
12-
Example1
13-
14-
Input: [1,0,5]
15-
16-
Output: 3
17-
18-
Explanation:
19-
1st move: 1 0 <-- 5 => 1 1 4
20-
2nd move: 1 <-- 1 <-- 4 => 2 1 3
21-
3rd move: 2 1 <-- 3 => 2 2 2
22-
Example2
23-
24-
Input: [0,3,0]
25-
26-
Output: 2
27-
28-
Explanation:
29-
1st move: 0 <-- 3 0 => 1 2 0
30-
2nd move: 1 2 --> 0 => 1 1 1
31-
Example3
32-
33-
Input: [0,2,0]
34-
35-
Output: -1
36-
37-
Explanation:
38-
It's impossible to make all the three washing machines have the same number of dresses.
39-
Note:
40-
The range of n is [1, 10000].
41-
The range of dresses number in a super washing machine is [0, 1e5].
42-
43-
*/
443
public class _517 {
454
public static class Solution1 {
465
/**

0 commit comments

Comments
 (0)