You are viewing a single comment's thread. Return to all comments →
I think reducing method does not give optimal solution:
for example:
1 2 3 (9) - need 2 operations
1 2 (3) -1 - need 2 operations
1 (2) -1 -1 - need 2 operations
(1) -1 -1 -1 - need 1 operation
-1 -1 -1 -1
total: 7 operations
But if we always don't change maximum element, and other element try to adjust to this max element
1 2 3 (9) - need 1 operation
6 7 8 (9) - need 1 operation
8 9 (10) 9 - need 1 operation
10 11 10 (11) - need 1 operation
11 (12) 11 11 - need 1 operation
12 12 12 12
total: 5 operations
Seems like cookies are disabled on this browser, please enable them to open this website
Equal
You are viewing a single comment's thread. Return to all comments →
I think reducing method does not give optimal solution:
for example:
1 2 3 (9) - need 2 operations
1 2 (3) -1 - need 2 operations
1 (2) -1 -1 - need 2 operations
(1) -1 -1 -1 - need 1 operation
-1 -1 -1 -1
total: 7 operations
But if we always don't change maximum element, and other element try to adjust to this max element
1 2 3 (9) - need 1 operation
6 7 8 (9) - need 1 operation
8 9 (10) 9 - need 1 operation
10 11 10 (11) - need 1 operation
11 (12) 11 11 - need 1 operation
12 12 12 12
total: 5 operations