Skip to content

Commit a0dd1bb

Browse files
rajaabdullah833idoocs
authored andcommitted
style: format code and docs with prettier
1 parent 398af75 commit a0dd1bb

File tree

1 file changed

+7
-6
lines changed
  • solution/3300-3399/3357.Minimize the Maximum Adjacent Element Difference

1 file changed

+7
-6
lines changed

solution/3300-3399/3357.Minimize the Maximum Adjacent Element Difference/README_EN.md

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -89,12 +89,13 @@ tags:
8989
#### Approach:
9090

9191
1. **Greedy Replacement Strategy**:
92-
- Traverse the array and determine the missing (-1) positions.
93-
- Identify the potential minimum and maximum values needed to replace the missing positions such that the absolute difference between adjacent elements is minimized.
94-
- Use binary search to minimize the maximum absolute difference.
92+
93+
- Traverse the array and determine the missing (-1) positions.
94+
- Identify the potential minimum and maximum values needed to replace the missing positions such that the absolute difference between adjacent elements is minimized.
95+
- Use binary search to minimize the maximum absolute difference.
9596

9697
2. **Binary Search for Optimization**:
97-
- Apply binary search to determine the best pair `(x, y)` that minimizes the maximum adjacent difference.
98+
- Apply binary search to determine the best pair `(x, y)` that minimizes the maximum adjacent difference.
9899

99100
#### Python3
100101

@@ -112,7 +113,7 @@ def minimize_max_diff(nums):
112113
return True
113114

114115
missing_positions = [i for i, val in enumerate(nums) if val == -1]
115-
116+
116117
left, right = 0, 10**9
117118
result = 10**9
118119

@@ -190,7 +191,7 @@ public:
190191
int minimizeMaxDifference(vector<int>& nums, int k) {
191192
int n = nums.size();
192193
sort(nums.begin(), nums.end());
193-
194+
194195
int l = 0, r = nums[n - 1] - nums[0];
195196
while (l < r) {
196197
int mid = l + (r - l) / 2;

0 commit comments

Comments
 (0)