371. Sum of Two Integers Medium

@problem@discussion
#Math#Bit Manipulation



1/**
2 * [371] Sum of Two Integers
3 *
4 * Given two integers a and b, return the sum of the two integers without using the operators + and -.
5 *  
6 * Example 1:
7 * Input: a = 1, b = 2
8 * Output: 3
9 * Example 2:
10 * Input: a = 2, b = 3
11 * Output: 5
12 *  
13 * Constraints:
14 * 
15 * 	-1000 <= a, b <= 1000
16 * 
17 */
18pub struct Solution {}
19
20// problem: https://leetcode.com/problems/sum-of-two-integers/
21// discuss: https://leetcode.com/problems/sum-of-two-integers/discuss/?currentPage=1&orderBy=most_votes&query=
22
23// submission codes start here
24
25impl Solution {
26    pub fn get_sum(a: i32, b: i32) -> i32 {
27        0
28    }
29}
30
31// submission codes end
32
33#[cfg(test)]
34mod tests {
35    use super::*;
36
37    #[test]
38    fn test_371() {
39    }
40}
41


Back
© 2025 bowen.ge All Rights Reserved.