JuniorMath

Convert Integer to the Sum of Two No-Zero Integers

No-Zero integer is a positive integer that does not contain any 0 in its decimal representation.

Given an integer n, return a list of two integers [a, b] where:

  • a and b are No-Zero integers.
  • a + b = n.

The test cases are generated so that there is at least one valid solution. If there are many valid solutions, you can return any of them.

Example 1
Inputn = 2
Output[1,1]
Let a = 1 and b = 1; both are no-zero integers, and a + b = 2 = n.
Example 2
Inputn = 11
Output[2,9]
Let a = 2 and b = 9; both are no-zero integers, and a + b = 11 = n.

Constraints

  • 2 <= n <= 10^4

Asked at 4 companies

</>

Your Solution

(Ctrl/Cmd + Enter)

Switching Language

Loading template...

Loading...

Sign in to save your progress

AI code evaluation

Get a correctness verdict, missed edge cases, and complexity analysis of your solution.

Sign in to evaluate