Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 70a4eb0

Browse files
add 2530
1 parent 1469045 commit 70a4eb0

File tree

2 files changed

+27
-0
lines changed

2 files changed

+27
-0
lines changed

README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,14 @@ _If you like this project, please leave me a star._ ★
88

99
| # | Title | Solutions | Video | Difficulty | Tag
1010
|------|----------------|------------------------------------------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------|----------------------------------|-------------
11+
<<<<<<< Updated upstream
1112
| 2515 |[Shortest Distance to Target String in a Circular Array](https://leetcode.com/problems/shortest-distance-to-target-string-in-a-circular-array/)| [Java](../master/src/main/java/com/fishercoder/solutions/_2515.java) |[:tv:](https://youtu.be/yTpRd3yvyz0)| Easy ||
1213
| 2520 |[Count the Digits That Divide a Number](https://leetcode.com/problems/count-the-digits-that-divide-a-number/)| [Java](../master/src/main/java/com/fishercoder/solutions/_2520.java) |[:tv:](https://youtu.be/7SHHsS5kPJ8)| Easy ||
14+
=======
15+
| 2530 |[Maximal Score After Applying K Operations](https://leetcode.com/problems/maximal-score-after-applying-k-operations/)| [Java](../master/src/main/java/com/fishercoder/solutions/_2530.java) || Medium |
16+
| 2515 |[Shortest Distance to Target String in a Circular Array](https://leetcode.com/problems/shortest-distance-to-target-string-in-a-circular-array/)| [Java](../master/src/main/java/com/fishercoder/solutions/_2515.java) || Easy ||
17+
| 2520 |[Count the Digits That Divide a Number](https://leetcode.com/problems/count-the-digits-that-divide-a-number/)| [Java](../master/src/main/java/com/fishercoder/solutions/_2520.java) | [:tv:](https://youtu.be/7SHHsS5kPJ8) | Easy ||
18+
>>>>>>> Stashed changes
1319
| 2496 |[Maximum Value of a String in an Array](https://leetcode.com/problems/maximum-value-of-a-string-in-an-array/)| [Java](../master/src/main/java/com/fishercoder/solutions/_2496.java) || Easy ||
1420
| 2467 |[Convert the Temperature](https://leetcode.com/problems/convert-the-temperature/)| [Java](../master/src/main/java/com/fishercoder/solutions/_2469.java) || Easy ||
1521
| 2455 |[Average Value of Even Numbers That Are Divisible by Three](https://leetcode.com/problems/average-value-of-even-numbers-that-are-divisible-by-three/)| [Java](../master/src/main/java/com/fishercoder/solutions/_2455.java) || Easy ||
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
package com.fishercoder.solutions;
2+
3+
import java.util.PriorityQueue;
4+
5+
public class _2530 {
6+
public static class Solution1 {
7+
public long maxKelements(int[] nums, int k) {
8+
long ans = 0L;
9+
PriorityQueue<Integer> maxHeap = new PriorityQueue<>((a, b) -> b - a);
10+
for (int num : nums) {
11+
maxHeap.offer(num);
12+
}
13+
while (k-- > 0) {
14+
int max = maxHeap.poll();
15+
ans += max;
16+
maxHeap.offer((int) Math.ceil((double) max / 3));
17+
}
18+
return ans;
19+
}
20+
}
21+
}

0 commit comments

Comments
 (0)