Skip to content

Commit ced41f0

Browse files
committed
2020-06-24
1 parent 670a364 commit ced41f0

File tree

3 files changed

+30
-0
lines changed

3 files changed

+30
-0
lines changed
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
class Solution(object):
2+
def maxProduct(self, nums):
3+
"""
4+
:type nums: List[int]
5+
:rtype: int
6+
"""
7+
l = sorted(nums)
8+
return (l[-1] - 1) * (l[-2] - 1)
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
class Solution(object):
2+
def shuffle(self, nums, n):
3+
"""
4+
:type nums: List[int]
5+
:type n: int
6+
:rtype: List[int]
7+
"""
8+
res = []
9+
for i in range(n):
10+
res.append(nums[i])
11+
res.append(nums[i + n])
12+
return res
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
class Solution(object):
2+
def getStrongest(self, arr, k):
3+
"""
4+
:type arr: List[int]
5+
:type k: int
6+
:rtype: List[int]
7+
"""
8+
arr.sort()
9+
m = arr[(len(arr) - 1) // 2]
10+
return sorted(arr, key = lambda x: abs(x - m))[-k:]

0 commit comments

Comments
 (0)