Skip to content

Commit 520403d

Browse files
committed
Update 2874. Maximum Value of an Ordered Triplet II.py
1 parent 3144310 commit 520403d

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
from typing import List
2+
3+
class Solution:
4+
def maximumTripletValue(self, nums: List[int]) -> int:
5+
ans = mx = mx_diff = 0
6+
for x in nums:
7+
ans = max(ans, mx_diff * x)
8+
mx_diff = max(mx_diff, mx - x)
9+
mx = m

0 commit comments

Comments
 (0)