#3340

Check Balanced String

newbie · 155 · lc easy +14 · 82.5% accepted · 139 likes · top 94%

Description

You are given a string num composed entirely of digits. The string is called balanced when the sum of digits at even positions equals the sum of digits at odd positions.

Return true if num is balanced, otherwise return false.

Code

1
2
3