1
2
3
4
5
6
|
class Solution:
def findMiddleIndex(self, nums: List[int]) -> int:
ans=-1
for i in range( len(nums)):
if sum(nums[:i])==sum(nums[i+1:]) : ans=i; break
return ans
|
cs |
반응형
'python-algorithm' 카테고리의 다른 글
leetcode 1394. Find Lucky Integer in an Array (0) | 2022.03.24 |
---|---|
leetcode 1491. Average Salary Excluding the Minimum and Maximum Salary (0) | 2022.03.24 |
leetcode 1619. Mean of Array After Removing Some Elements (0) | 2022.03.23 |
leetcode 349. Intersection of Two Arrays (0) | 2022.03.23 |
leetcode 2085. Count Common Words With One Occurrence (0) | 2022.03.22 |
댓글