Skip to content

Commit 748e6d7

Browse files
add 1827
1 parent 74c47d1 commit 748e6d7

File tree

2 files changed

+17
-0
lines changed

2 files changed

+17
-0
lines changed

README.md

+1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ _If you like this project, please leave me a star._ ★
88

99
| # | Title | Solutions | Video | Difficulty | Tag
1010
|-----|----------------|---------------|--------|-------------|-------------
11+
|1827|[Minimum Operations to Make the Array Increasing](https://leetcode.com/problems/minimum-operations-to-make-the-array-increasing/)|[Solution](../master/src/main/java/com/fishercoder/solutions/_1827.java) ||Easy|Array, Greedy|
1112
|1823|[Find the Winner of the Circular Game](https://leetcode.com/problems/find-the-winner-of-the-circular-game/)|[Solution](../master/src/main/java/com/fishercoder/solutions/_1823.java) ||Medium|Array|
1213
|1822|[Sign of the Product of an Array](https://leetcode.com/problems/sign-of-the-product-of-an-array/)|[Solution](../master/src/main/java/com/fishercoder/solutions/_1822.java) ||Easy|Math|
1314
|1817|[Finding the Users Active Minutes](https://leetcode.com/problems/finding-the-users-active-minutes/)|[Solution](../master/src/main/java/com/fishercoder/solutions/_1817.java) ||Medium|HashTable|
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
package com.fishercoder.solutions;
2+
3+
public class _1827 {
4+
public static class Solution1 {
5+
public int minOperations(int[] nums) {
6+
int minsOps = 0;
7+
for (int i = 1; i < nums.length; i++) {
8+
if (nums[i] <= nums[i - 1]) {
9+
minsOps += nums[i - 1] - nums[i] + 1;
10+
nums[i] = nums[i - 1] + 1;
11+
}
12+
}
13+
return minsOps;
14+
}
15+
}
16+
}

0 commit comments

Comments
 (0)