Add Binary Code Implementation

Please comment the mistakes in the question Add Binary,
Please specify the mistake as I am getting Time Limit Exceeded in the question, also suggest me the correct approach to solve it as the approach seems chaotic with all if-else’s.
Code Implementaion:- https://ide.codingblocks.com/s/486333.
Question link is:-https://leetcode.com/problems/add-binary/.

hello @Sakshi2004

in ur while loop (for only i and for only j ) u are not updating those pointers

https://ide.codingblocks.com/s/486369, Updated the code, still giving me wrong answer.

Please check this one:- https://ide.codingblocks.com/s/486373

in while loop(lin 44) use b[j] in place of b[i]

https://ide.codingblocks.com/s/486821, Updated the code, still not correct answer. Please tell the other way then to do it, except to convert each string to integer and then do conversion, because that I have tried but it is giving some error as there is an overflow in data type of variable used.

@Sakshi2004

use long long to avpid overflow.

also look at this simple short and easy implementation ->

    string addBinary(string a, string b)
    {
        string s = "";
        
        int c = 0, i = a.size() - 1, j = b.size() - 1;
        while(i >= 0 || j >= 0 || c == 1)
        {
            c += i >= 0 ? a[i --] - '0' : 0;
            c += j >= 0 ? b[j --] - '0' : 0;
            s = char(c % 2 + '0') + s;
            c /= 2;
        }
        
        return s;
    }

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.