Add Binary numbers in C++ – LeetCode Solution [Easy]

This problem could be solved in O(N) time complexity, where N is the maximum of the given two strings length. We could start traversing the two strings from the last and keep calculating the sum of each string’s character ie ‘0’ and ‘1’. If there’s a carry propagate it to the sum of the next digits in iteration.

C++ Standard Template Library (STL) – [Vector]

A vector is a data structure for maintaining a set of elements having a specific data type. Vectors can be considered as arrays having dynamic size. Just like arrays, vectors also store its elements in a contiguous storage locations.