Convert Integer to the Sum of Two No-Zero Integers
Easy · Math
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:
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
Input: n = 2 Output: [1,1]
Let a = 1 and b = 1. Both a and b are no-zero integers, and a + b = 2 = n.
Example 2
Input: n = 11 Output: [2,9]
Let a = 2 and b = 9. Both a and b are no-zero integers, and a + b = 11 = n. Note that there are other valid answers as [8, 3] that can be accepted.
Constraints
- 2 <= n <= 104
Starter code (python)
class Solution(object):
def getNoZeroIntegers(self, n):
"""
:type n: int
:rtype: List[int]
"""
Related problems
- Add Two Numbers (Medium)
- Reverse Integer (Medium)
- Palindrome Number (Easy)
Previous: Minimum Insertion Steps to Make a String Palindrome · Next: Number of Operations to Make Network Connected · All problems
Zepruv is a technical interview practice platform. Read any problem for free; sign in to run your code, submit and keep your progress.