|
1 | 1 | """ |
2 | 2 | You are given an array nums of n positive integers. |
3 | 3 |
|
4 | | -You can perform two types of operations on any |
| 4 | +You can perform two types of operations on any |
5 | 5 | element of the array any number of times: |
6 | 6 |
|
7 | 7 | If the element is even, divide it by 2. |
8 | | -For example, if the array is [1,2,3,4], then you can do this operation |
| 8 | +For example, if the array is [1,2,3,4], then you can do this operation |
9 | 9 | on the last element, and the array will be [1,2,3,2]. |
10 | 10 | If the element is odd, multiply it by 2. |
11 | 11 | For example, if the array is [1,2,3,4], then you can do this operation |
12 | 12 | on the first element, and the array will be [2,2,3,4]. |
13 | | -The deviation of the array is the maximum difference between |
| 13 | +The deviation of the array is the maximum difference between |
14 | 14 | any two elements in the array. |
15 | 15 |
|
16 | | -Return the minimum deviation the array can have after performing |
| 16 | +Return the minimum deviation the array can have after performing |
17 | 17 | some number of operations. |
18 | 18 | """ |
19 | 19 |
|
20 | 20 | from heapq import heapify, heappop, heappush |
21 | | - |
| 21 | + |
22 | 22 |
|
23 | 23 | class Solution: |
24 | 24 | def minimum_deviation(self, nums) -> int: |
|
0 commit comments