0ms Runtime with best Case Time Complexity using C Language and Suitable String Operations : )
IntuitionThe problem requires checking whether the sum of digits at even indices equals the sum at odd indices. By iterating through the string of digits, you c
# Intuition
<!-- Describe your first thoughts on how to solve this problem. -->
The problem requires checking whether the sum of digits at even indices equals the sum at odd indices. By iterating through the string of digits, you can categorize the digits based on their indices and compute two separate sums. If these sums are equal, the string is considered "balanced."
# Approach
<!-- Describe your approach to solving the problem. -->
Initialize Variables:

Create two variables, sumeven and sumodd, both set to 0, to store the sums of digits at even and odd indices, respectively.

Iterate Through the String:

Traverse the string character by character using a loop.

Convert each character to its corresponding numeric value using num[i] - '0'.

Add the numeric value to either sumeven or sumodd based on the parity of the index (i % 2).

Comparison:

After the loop finishes, compare sumeven and sumodd.

Return true if the sums are equal; otherwise, return false.


![Screenshot 2025-03-15 114151.png](https://assets.leetcode.com/users/images/d029246a-0c18-44e8-8e11-d8482f524d31_1742019133.2082827.png)


# 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
```c []
bool isBalanced(char* num) {
    int sumeven = 0, sumodd = 0;
    for(int i=0; num[i] != '\0'; i++)
    {
        if(i%2==0)
        {
            sumeven = sumeven + num[i] - '0';
        }
        else
        {
            sumodd = sumodd + num[i] - '0';
        }
    }
    return sumeven == sumodd;
}
```
['C']