A digit is considered isolated if both its left and right neighbors are different from itself. For example, in the number 776444, the digit 6 is isolated, but the other digits are not. Complete the function that returns if the given input number contains an isolated digit or not.
Solution Stats
Problem Comments
1 Comment
Solution Comments
Show comments
Loading...
Problem Recent Solvers17
Suggested Problems
-
634 Solvers
-
Return the first and last characters of a character array
12524 Solvers
-
MATCH THE STRINGS (2 CHAR) very easy
301 Solvers
-
517 Solvers
-
Sum the squares of numbers from 1 to n
261 Solvers
More from this Author53
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
Just a note that Test Case 3 has a slight probability that all the digits in the number will be zero, in which case a correct solution (digit 0 is isolated) will fail the assertion (presumes all digits are repeating). This happened to me once while I was testing with the code repeatedly, but fortunately did not happen when I went to submit.