leetcode --67. Add Binary
来源:互联网 发布:飞机大战java代码框架 编辑:程序博客网 时间:2024/05/19 00:52
题目:https://leetcode.com/problems/add-binary/tabs/description
代码:
class Solution {public: string addBinary(string a, string b) { int i = a.size()-1,j = b.size()-1,temp=0; string c; while(i>=0|j>=0|temp==1){ if(i>=0){ temp+=a[i--]-'0'; } if(j>=0){ temp+=b[j--]-'0'; } c+=char(temp%2+'0'); temp=temp/2; } reverse(c.begin(),c.end()); return c; }};
阅读全文
0 0
- [LeetCode]67.Add Binary
- LeetCode --- 67. Add Binary
- [Leetcode] 67. Add Binary
- [leetcode] 67.Add Binary
- 【leetcode】67. Add Binary
- [leetcode] 67.Add Binary
- [leetcode] 67. Add Binary
- 【Leetcode】67. Add Binary
- 67. Add Binary LeetCode
- 【LeetCode】67. Add Binary
- leetcode--67. Add Binary
- leetcode 67. Add Binary
- LeetCode 67. Add Binary
- LeetCode *** 67. Add Binary
- leetcode 67. Add Binary
- 【leetcode】67.Add Binary
- LeetCode 67. Add Binary
- LeetCode-67.Add Binary
- CSS清除浮动大全共8种方法
- win7电脑开启屏幕旋转功能吗 Win7系统屏幕的旋转功能如何使用
- 提高班各期Foxmail订阅地址
- 线程同步-用户模式下同步(原子锁、临界区、读写锁)
- ajax上传文件
- leetcode --67. Add Binary
- C语言(7)ASCII码值排序
- Face Detection(1)
- Ping++ 支付接口对接
- UVA11997-多路归并排序-K Smallest Sums
- Visual Studio 各版本下载
- 个人心得
- 搭建git for windows服务器(100%可以成功)
- hdu 6040 Hints of sd0061(STL)