CodingEasy
Sum of even or odd position digits based on a flag
Filed under Hexaview
The question
Given an integer N and a boolean flag, return the sum of the digits at even positions if the flag is true, or the sum of the digits at odd positions if the flag is false.
No write-up yet. Related questions below have one.
Related Hexaview questions
Collected from public candidate posts and coding forums. Updated Nov 2026.