Skip to content

Commit be593fc

Browse files
authored
Create find-the-array-concatenation-value.py
1 parent c0e22c1 commit be593fc

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# Time: O(nlogr)
2+
# Space: O(1)
3+
4+
import math
5+
6+
7+
# math
8+
class Solution(object):
9+
def findTheArrayConcVal(self, nums):
10+
"""
11+
:type nums: List[int]
12+
:rtype: int
13+
"""
14+
return sum((nums[i]*10**(int(math.log10(nums[~i]))+1) for i in xrange(len(nums)//2)))+sum(nums[i] for i in xrange(len(nums)//2, len(nums)))

0 commit comments

Comments
 (0)