Skip to content

Commit 33e4421

Browse files
committed
Adding EfficientSolution - Problem - 415 - Add Strings
1 parent 9af563d commit 33e4421

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

Add_Strings/EfficientSolution.py

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
##==================================
2+
## Leetcode
3+
## Student: Vandit Jyotindra Gajjar
4+
## Year: 2020
5+
## Problem: 415
6+
## Problem Name: Add Strings
7+
##===================================
8+
#
9+
#Given two non-negative integers num1 and num2 represented as string, return the sum of num1 and num2.
10+
#
11+
#Note:
12+
#
13+
#The length of both num1 and num2 is < 5100.
14+
#Both num1 and num2 contains only digits 0-9.
15+
#Both num1 and num2 does not contain any leading zero.
16+
#You must not use any built-in BigInteger library or convert the inputs to integer directly.
17+
class Solution:
18+
def addStrings(self, num1, num2):
19+
tmp = int(num1) + int(num2) #Initialize tmp and convert the numbers to int
20+
return str(tmp) #We return str of tmp

0 commit comments

Comments
 (0)