Skip to content

Commit 5adecd4

Browse files
refactor 1046
1 parent a1e6274 commit 5adecd4

File tree

1 file changed

+0
-25
lines changed

1 file changed

+0
-25
lines changed

src/main/java/com/fishercoder/solutions/_1046.java

-25
Original file line numberDiff line numberDiff line change
@@ -2,31 +2,6 @@
22

33
import java.util.PriorityQueue;
44

5-
/**
6-
* 1046. Last Stone Weight
7-
*
8-
* We have a collection of rocks, each rock has a positive integer weight.
9-
*
10-
* Each turn, we choose the two heaviest rocks and smash them together.
11-
* Suppose the stones have weights x and y with x <= y. The result of this smash is:
12-
*
13-
* If x == y, both stones are totally destroyed;
14-
* If x != y, the stone of weight x is totally destroyed, and the stone of weight y has new weight y-x.
15-
* At the end, there is at most 1 stone left. Return the weight of this stone (or 0 if there are no stones left.)
16-
*
17-
* Example 1:
18-
* Input: [2,7,4,1,8,1]
19-
* Output: 1
20-
* Explanation:
21-
* We combine 7 and 8 to get 1 so the array converts to [2,4,1,1,1] then,
22-
* we combine 2 and 4 to get 2 so the array converts to [2,1,1,1] then,
23-
* we combine 2 and 1 to get 1 so the array converts to [1,1,1] then,
24-
* we combine 1 and 1 to get 0 so the array converts to [1] then that's the value of last stone.
25-
*
26-
* Note:
27-
* 1 <= stones.length <= 30
28-
* 1 <= stones[i] <= 1000
29-
* */
305
public class _1046 {
316
public static class Solution1 {
327
public int lastStoneWeight(int[] stones) {

0 commit comments

Comments
 (0)