LeetCode solutions

3636. Check Balanced String

My accepted Python solution to LeetCode problem 3636, Check Balanced String, running in 0ms.

  • Difficulty: Easy
  • Python
  • Runtime 0ms
  • Memory 17.5MB

Read the problem on LeetCode View on GitHub

Python

Accepted on LeetCode — runtime 0ms, memory 17.5MB, accepted 2025-12-31.

python
class Solution:
    def isBalanced(self, num: str) -> bool:
        even_sum = sum(int(num[i]) for i in range(0, len(num), 2))
        odd_sum = sum(int(num[i]) for i in range(1, len(num), 2))
        return even_sum == odd_sum

Source