From a96b65cbfad7f62f3db6b2eab105e4e25c0414c5 Mon Sep 17 00:00:00 2001 From: Jack Sangdahl Date: Fri, 27 Jun 2025 12:23:02 -0600 Subject: chore: remove old cpp and rust solutions --- other/add_binary.cpp | 30 ------------------------------ 1 file changed, 30 deletions(-) delete mode 100644 other/add_binary.cpp (limited to 'other/add_binary.cpp') diff --git a/other/add_binary.cpp b/other/add_binary.cpp deleted file mode 100644 index 9afc1dc..0000000 --- a/other/add_binary.cpp +++ /dev/null @@ -1,30 +0,0 @@ -// 67. Add Binary -#include "leetcode.h" - -class Solution { -public: - string addBinary(string a, string b) { - int i = a.size() - 1, j = b.size() - 1, carry = 0; - string ans; - while (i >= 0 || j >= 0 || carry) { - if (i >= 0) { - carry += a[i] - '0'; - i--; - } - if (j >= 0) { - carry += b[j] - '0'; - j--; - } - ans += (carry % 2 + '0'); - carry /= 2; - } - reverse(ans.begin(), ans.end()); - return ans; - } -}; - -int main() { - Solution obj; - cout << obj.addBinary("11", "1") << endl; // expect: 100 - cout << obj.addBinary("1010", "1011") << endl; // expect: 10101 -} -- cgit v1.2.3