Practice Check Balanced String
Read the task, work through the examples, and check your approach against the constraints. Use the original LeetCode task for coding and submissions.
Problem Statement
You are given a string num consisting of only digits. A string of digits is called balanced if the sum of the digits at even indices is equal to the sum of digits at odd indices. Return true if num is balanced, otherwise return false.
Source: Check Balanced String on LeetCode. Use the original task for its coding environment and submissions.
Examples
# Example 1
Input
num = "1234"
Output
false
# Example 2
Input
num = "24123"
Output
true
Constraints
2 <= num.length <= 100
num consists of digits only
Related LeetCode Problems
Practice more problems similar to Check Balanced String.
Review your practice with PhantomCodeAI
After trying the problem yourself, use the app to discuss your approach, complexity, and edge cases.