Sum of Two
Easy · rating 800 · Math, Implementation
Read two space-separated integers a and b on a single line. Print their sum.
Constraints: -109 ≤ a, b ≤ 109
Editorial
Sum of Two is the simplest warm-up: read two integers and print their sum. The one gotcha is range — two values near 10⁹ sum past 32-bit limits, so use a 64-bit integer type (Python and JavaScript widen automatically).
a, b = map(int, input().split())
print(a + b)Complexity
Time: O(1). Space: O(1).
Related problems
- Even Numbers Up To N — Easy
- Tip Total — Easy
- Leap Year — Easy
- FizzBuzz — Easy
- Hex to Decimal — Easy
- Parking Fee — Easy