Problem 145. Increment a number, given its digits
Take as input an array of digits (e.g. x = [1 2 3]) and output an array of digits that is that number "incremented" properly, (in this case, y = [1 2 4]).
Examples of proper input/output:
x = [1 9 1 9] ----> y = [1 9 2 0]
and
x = [9 9 9] ----> y = [1 0 0 0]
Solution Stats
Problem Comments
-
1 Comment
TAO Ran
on 12 Nov 2014
Anyone has suggestions on a clean way of doing this?
Solution Comments
Show commentsProblem Recent Solvers659
Suggested Problems
-
Given an unsigned integer x, find the largest y by rearranging the bits in x
1857 Solvers
-
Determine the number of odd integers in a vector
755 Solvers
-
find the maximum element of the matrix
510 Solvers
-
convert matrix to single column
415 Solvers
-
610 Solvers
More from this Author23
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!