-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.cpp
More file actions
36 lines (33 loc) · 958 Bytes
/
main.cpp
File metadata and controls
36 lines (33 loc) · 958 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
// Source: https://leetcode.com/problems/add-two-integers
// Title: Add Two Integers
// Difficulty: Easy
// Author: Mu Yang <http://muyang.pro>
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Given two integers `num1` and `num2`, return the **sum** of the two integers.
//
// **Example 1:**
//
// ```
// Input: num1 = 12, num2 = 5
// Output: 17
// Explanation: num1 is 12, num2 is 5, and their sum is 12 + 5 = 17, so 17 is returned.
// ```
//
// **Example 2:**
//
// ```
// Input: num1 = -10, num2 = 4
// Output: -6
// Explanation: num1 + num2 = -6, so -6 is returned.
// ```
//
// **Constraints:**
//
// - `-100 <= num1, num2 <= 100`
//
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
using namespace std;
class Solution {
public:
int sum(int num1, int num2) { return num1 + num2; }
};