1018. Replace All Zeros With Ones

You are given an integer N. Your task is to return the integer formed by replacing every digit 0 with 1 in the decimal representation of N.

Example 1:

Input: N = 102003

Output: 112113

Explanation: 0s at 2nd, 4th and 5th positions are replaced with 1.

Example 2:

Input: N = 204

Output: 214

Explanation: 0 in the second digit is replaced with 1.

Now Your Turn!

Pick the correct output for the given input

Input: N = 1000

Still unsure what the problem is asking ?

Let’s go through a few more examples, step by step, to make it clearer.

Constraints:

  • 1 ≤ N ≤ 10⁹
  • Input is always a positive integer, no leading zeroes.
0
class Solution {
public:
int replaceZerosWithOnes(int N) {
// Your code goes here
}
};
 
Test Case

Input:

N