https://www.codewars.com/kata/5966e33c4e686b508700002d
Codewars - Achieve mastery through coding practice and developer mentorship
A coding practice website for all programming levels – Join a community of over 3 million developers and improve your coding skills in over 55 programming languages!
www.codewars.com
DESCRIPTION:
Create a function that takes 2 integers in form of a string as an input, and outputs the sum (also as a string):
Example: (Input1, Input2 -->Output)
"4", "5" --> "9"
"34", "5" --> "39"
"", "" --> "0"
"2", "" --> "2"
"-5", "3" --> "-2"
Notes:
- If either input is an empty string, consider it as zero.
- Inputs and the expected output will never exceed the signed 32-bit integer limit (2^31 - 1)
코드
function sumStr(a,b) {
return String(Number(a) + Number(b));
}
'알고리즘 > Codewars' 카테고리의 다른 글
[Codewars] Enumerable Magic - Does My List Include This? (8 kyu) / JavaScript (0) | 2023.03.26 |
---|---|
[Codewars] Find the capitals (7 kyu) / JavaScript (0) | 2023.03.25 |
[Codewars] Form The Minimum (7 kyu) / JavaScript (0) | 2023.03.23 |
[Codewars] Grasshopper - Terminal game combat function (8 kyu) / JavaScript (0) | 2023.03.22 |
[Codewars] Is the string uppercase? (8 kyu) / JavaScript / Python (0) | 2023.03.21 |
댓글