Integer String Addition
Start Timer
0:00:00
Write a Python function that adds together all combinations of adjacent integers of a given string of integers named int_str
.
Example 1:
Input:
int_str = '12'
Output:
def int_str_addition -> 1 + 2 + 12 = 15
Example 2:
Input:
int_str = '123'
Output:
def int_str_addition(int_str) -> 1 + 2 + 3 + 12 + 23 + 123 = 164
#in this case, 13 is not part of our sum as 1 and 3 are not adjacent in '123'
Recommended questions for you
Personalized based on your user activity, skill level, and preferences.
.
.
.
.
.
.
.
.
.
Comments