Skip to content

Commit

Permalink
Create find-the-array-concatenation-value.py
Browse files Browse the repository at this point in the history
  • Loading branch information
kamyu104 authored Feb 16, 2023
1 parent c0e22c1 commit be593fc
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions Python/find-the-array-concatenation-value.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Time: O(nlogr)
# Space: O(1)

import math


# math
class Solution(object):
def findTheArrayConcVal(self, nums):
"""
:type nums: List[int]
:rtype: int
"""
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 comments on commit be593fc

Please sign in to comment.