🌹 EASY SOLUTION [SINGLE VARIABLE]
\n\n# \uD83D\uDC93**_PLEASE CONSIDER UPVOTING_**\uD83D\uDC93\n\n \n\n\n\n# \u2B50 Intuition\nThe task is to determine if the string of digits is balanced. A bal
<div align="center">\n\n# \uD83D\uDC93**_PLEASE CONSIDER UPVOTING_**\uD83D\uDC93\n\n</div>\n\n***\n\n# \u2B50 Intuition\nThe task is to determine if the string of digits is balanced. A balanced string is defined by the condition that the sum of the digits at even indices equals the sum of the digits at odd indices. The solution requires iterating through the string and using a single cumulative sum to track the balance.\n\n# \u2B50 Approach\n1. **Initialize a Cumulative Sum**:\n   - Start with a variable that tracks the difference between the sums of digits at even and odd indices.\n2. **Iterate Through the String**:\n   - For each character in the string, convert it to its integer value.\n   - Depending on the index (even or odd), add the digit value to the cumulative sum for even indices and subtract it for odd indices.\n3. **Check Balance**:\n   - After processing all characters, check if the cumulative sum is zero. If it is, the string is balanced; otherwise, it is not.\n\n# \u2B50 Complexity\n- **Time Complexity**: O(n), where n is the length of the string, as we iterate through the string once.\n- **Space Complexity**: O(1), as we use a fixed amount of space regardless of input size.\n\n# \u2B50 Code\n```java\nclass Solution {\n    public boolean isBalanced(String num) {\n        int sum = 0;\n\n        for (int i = 0; i < num.length(); i++) {\n            int sum1 = num.charAt(i) - \'0\';\n\n            if (i % 2 == 0) {\n                sum += sum1;  // Add for even indices\n            } else {\n                sum -= sum1;  // Subtract for odd indices\n            }\n        }\n\n        return sum == 0;  // Check if sums are balanced\n    }\n}\n```
['String', 'Java']