67. Add Binary Easy
1/**
2 * [67] Add Binary
3 *
4 * Given two binary strings a and b, return their sum as a binary string.
5 *
6 * Example 1:
7 * Input: a = "11", b = "1"
8 * Output: "100"
9 * Example 2:
10 * Input: a = "1010", b = "1011"
11 * Output: "10101"
12 *
13 * Constraints:
14 *
15 * 1 <= a.length, b.length <= 10^4
16 * a and b consist only of '0' or '1' characters.
17 * Each string does not contain leading zeros except for the zero itself.
18 *
19 */
20pub struct Solution {}
21
22// problem: https://leetcode.com/problems/add-binary/
23// discuss: https://leetcode.com/problems/add-binary/discuss/?currentPage=1&orderBy=most_votes&query=
24
25// submission codes start here
26
27impl Solution {
28 pub fn add_binary(a: String, b: String) -> String {
29 String::new()
30 }
31}
32
33// submission codes end
34
35#[cfg(test)]
36mod tests {
37 use super::*;
38
39 #[test]
40 fn test_67() {
41 }
42}
43
Back
© 2025 bowen.ge All Rights Reserved.