Skip to content
Discussion options

You must be logged in to vote

We need to find two integers a and b such that their sum equals the given integer n, and neither a nor b contains the digit '0' in their decimal representation. The solution involves checking pairs of integers that sum to n until we find a pair where both integers are no-zero integers.

Approach

  1. Iterate through possible pairs: For each integer i from 1 to n/2, check if both i and n - i are no-zero integers. This range ensures we cover all possible pairs without redundancy.
  2. Check for no-zero integers: For each candidate integer, check if it contains the digit '0' by repeatedly examining its last digit and removing it. If any digit is '0', the integer is invalid.
  3. Return the first valid pair:…

Replies: 1 comment 2 replies

Comment options

mah-shamim
Sep 8, 2025
Maintainer Author

You must be logged in to vote
2 replies
@topugit
Comment options

topugit Sep 8, 2025
Collaborator

@mah-shamim
Comment options

mah-shamim Sep 8, 2025
Maintainer Author

Answer selected by topugit
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
question Further information is requested easy Difficulty
2 participants