MCPcopy Create free account
hub / github.com/Vishruth-S/CompetitiveCode / Solution

Class Solution

LeetCode_problems/Add Strings/Solution.py:15–28  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

13
14#Solution 1: List method
15class Solution:
16 def addStrings(self, num1: str, num2: str) -> str:
17 s=[]
18 r=[]
19 n=len(num1)
20 m=len(num2)
21 for i in range(n):
22 s.append(num1[i])
23 for i in range(m):
24 r.append(num2[i])
25 res = int("".join(s))
26 res1 = int("".join(r))
27 ans=res+res1
28 return str(ans)
29
30#solution 2: (elementary math(carry method))
31class Solution:

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected