Question: 1. Plus One Implement a function called plus_one that: 1. takes an array of decimal digits m to initialize the represented integer; ifm is an
1. Plus One Implement a function called plus_one that: 1. takes an array of decimal digits m to initialize the represented integer; ifm is an empty array, it means the represented integer is 0. 2. Increases the represented number by 1. 3. returns the represented decimal number as a string (with leading o(s) removed) Example 1: Input: plus_one([1, 2, 3, 4, 5]) Output: "12346 361 31 Example 2: Input: plus_one(191) Output: 10" Example 3: Input: plus one (1999) Output: "1000" Example 3: Input: plus_one([9, 9, 9]) Output: "1000" Example 4: Input: plus_one([0, 0]) Output: "1" Example 5: Input: plus_one (1) Output: "1" Constraints: . All items in array mare decimal numbers with range 10,91 Arraym has a length of 0 to 1000 Arrays will always be provided non null) when |
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
