Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def countWaysToChangeDigit(value)
- string = value.to_s
- string_length = string.length
- x = 0
- y = 0
- ways = 0
- while (x < string_length)
- while (y <= 9)
- string[x] = y.to_s
- if string.to_i > value then
- ways = ways + 1
- end
- y = y + 1
- end
- y = 0
- x = x + 1
- string = value.to_s
- end
- return ways
- end
Advertisement
Add Comment
Please, Sign In to add comment