Add Binary | leetcode 67 | Hindi

Sdílet
Vložit
  • čas přidán 18. 07. 2020
  • liked this video? Click here / @codebix1096
    join our Facebook group :- / 258049468776636
    problem :- leetcode.com/problems/add-bin...
    code :- github.com/luckykumardev/leet...

Komentáře • 23

  • @anujgajbhiye5947
    @anujgajbhiye5947 Před rokem +3

    after getting stucked at the same problem and watching many complicated videos, i found the right video...

  • @pratyushasarangi9854
    @pratyushasarangi9854 Před 2 lety +1

    Nice explanation!! Keep uploading more videos on leetcode problems

  • @charusingh8401
    @charusingh8401 Před 4 lety

    Wonderful Explanation.

  • @aniruddhac99
    @aniruddhac99 Před 2 lety +1

    NICE explaination. Subscribed.

  • @rosonerri-faithful
    @rosonerri-faithful Před 3 lety +1

    Awesome Explanation Sir,....Sir Multiply Strings ka ek explanation video upload krdijiye

  • @meghawadhera2089
    @meghawadhera2089 Před 4 lety +1

    Another video well explained. Please keep up the good work..Thank you so much.

  • @abhayrai1724
    @abhayrai1724 Před 3 lety

    Great 🔥🎉

  • @anshumaan1024
    @anshumaan1024 Před 10 měsíci +2

    Working C++ code ✅🙂
    class Solution {
    public:
    string addBinary(string a, string b) {
    int aSize = a.size();
    int bSize = b.size();
    int i = 0;
    int carry = 0;
    string ans = "";
    while( i

  • @davinder95
    @davinder95 Před rokem +2

    u need to use String Builder and reverse it like this;
    class Solution {
    public String addBinary(String a, String b) {
    int carry = 0;
    int aLen = a.length();
    int bLen = b.length();
    int i = 0;
    StringBuilder ans = new StringBuilder();

    while(i

  • @aashukumar1348
    @aashukumar1348 Před 2 lety

    Wow❣️

  • @abhishekranjan1094
    @abhishekranjan1094 Před 2 lety

    Awesome

  • @ajayjangid1164
    @ajayjangid1164 Před 2 lety

    like++; nice explanation.👍

  • @tanmesh2820
    @tanmesh2820 Před rokem

    your explaination is great but this code is not passing all the test cases ! please check before your explain

    • @anshumaan1024
      @anshumaan1024 Před 10 měsíci +1

      Working C++ code ✅🙂
      class Solution {
      public:
      string addBinary(string a, string b) {
      int aSize = a.size();
      int bSize = b.size();
      int i = 0;
      int carry = 0;
      string ans = "";
      while( i

  • @danddentertainment-n2p
    @danddentertainment-n2p Před rokem +1

    string addBinary(string a, string b) {
    string s = "";
    int n1 = a.length() - 1, n2 = b.length() - 1;
    int carry = 0;
    while(n1 >= 0 && n2 >= 0)
    {
    if(a[n1] == '0' && b[n2] == '0')
    {
    if(carry == 0)
    {
    s = '0' + s;
    }
    else
    {
    s = '1' + s;
    carry = 0;
    }
    }
    else if(a[n1] == '1' && b[n2] == '1')
    {
    if(carry == 0)
    {
    s = '0' + s;
    carry = 1;
    }
    else
    {
    s = '1' + s;
    }
    }
    else
    {
    if(carry == 0)
    {
    s = '1' + s;
    }
    else
    {
    s = '0' + s;
    }
    }
    --n1;
    --n2;
    }
    while(n1 >= 0)
    {
    if(carry == 0)
    {
    s = a[n1] + s;
    }
    else
    {
    if(a[n1] == '0')
    {
    s = '1' + s;
    carry = 0;
    }
    else
    {
    s = '0' + s;
    }
    }
    --n1;
    }
    while(n2 >= 0)
    {
    if(carry == 0)
    {
    s = b[n2] + s;
    }
    else
    {
    if(b[n2] == '0')
    {
    s = '1' + s;
    carry = 0;
    }
    else
    {
    s = '0' + s;
    }
    }
    --n2;
    }
    if(carry == 1)
    {
    s = '1' + s;
    }
    return s;
    }

  • @mani_tyagi10
    @mani_tyagi10 Před 2 lety +3

    program doesn't run 🙄😏

    • @davinder95
      @davinder95 Před rokem

      bhai reverse krni pdegi string

    • @anshumaan1024
      @anshumaan1024 Před 10 měsíci +1

      Working C++ code ✅🙂
      class Solution {
      public:
      string addBinary(string a, string b) {
      int aSize = a.size();
      int bSize = b.size();
      int i = 0;
      int carry = 0;
      string ans = "";
      while( i

  • @akritiraj5797
    @akritiraj5797 Před rokem +1

    Your code is not working.

    • @anshumaan1024
      @anshumaan1024 Před 10 měsíci +1

      Working C++ code ✅🙂
      class Solution {
      public:
      string addBinary(string a, string b) {
      int aSize = a.size();
      int bSize = b.size();
      int i = 0;
      int carry = 0;
      string ans = "";
      while( i