Simple C++ solution by traversing the string.
Complexity
Time complexity:O(N)

Space complexity:O(1)
Code


# Complexity
- Time complexity:O(N)
<!-- Add your time complexity here, e.g. $$O(n)$$ -->

- Space complexity:O(1)
<!-- Add your space complexity here, e.g. $$O(n)$$ -->

# Code
```cpp []
class Solution {
public:
    bool isBalanced(string num) {
        int sumo=0,sume=0;
        for(int i=0;i<num.size();i++)
        {
            if(i%2==0)
            sume+=num[i]-'0';
            else
            sumo+=num[i]-'0';
        }
        return sume==sumo;
    }
};
```
['String', 'C++']