Please enter your email address or userHandle.
You are given an integer N. You need to convert all zeroes of N to 5.
N = 1004
Explanation: There are two zeroes in 1004
on replacing all zeroes with "5", the new
number will be "1554".
N = 121
Explanation: Since there are no zeroes in
"121", the number remains as "121".
Your task is to complete the function convertFive() which takes an integer N as an argument and replaces all zeros in the number N with 5. Your function should return the converted number.
Expected Time Complexity: O(K) where K is the number of digits in N
Expected Auxiliary Space: O(1)
1 <= n <= 10000
We strongly recommend solving this problem on your own before viewing its editorial. Do you still want to view the editorial?
Login to access your submissions.
Please choose 'ReadOnlyMode' if you needn't to 'Edit' the problem e.g. viewing OJ's solution, TestCase Files (TCFs), TimeLimit etc.