Code:
class Solution:
def lastStoneWeight(self, stones: List[int]) -> int:
while(len(stones)>1):
heaviest=max(stones);
stones.remove(heaviest);
heavier=max(stones);
stones.remove(heavier);
if(heaviest!=heavier):
stones.append(heaviest-heavier);
if(len(stones)==0):
return 0;
else:
return stones[0];

Python for beginners: https://www.youtube.com/watch?v=egq7Z...

Telegram: https://t.me/clcoding_python https://www.facebook.com/pirawenpython/

Python for beginners: https://www.youtube.com/watch?v=egq7Z...

Telegram: https://t.me/clcoding_python https://www.facebook.com/pirawenpython/

## 0 Comments:

## Post a Comment